Unit 6: Design Assignment
The relational database design process includes the process of identifying the tables, and the fields (columns) with associated types. The types of fields may differ from one database management system to another.
For example, MySQL database field types are given in this document: Data Types (Links to an external site.). They include text, numerical (data or ID) date and other field types.
As we learned, some of the fields could also be used to store IDs of records from another (related tables) to provide relations between the records. For example, if one table lists classes, another one lists students, we can create a table to record student enrollment. Then the enrollment table should have student IDs and class ID as its fields to record enrollment of the particular student into a particular class.
A new startup company is planning to build a system that would collect user preferences over different venues (restaurants, movie theaters, museums, etc.). The company utilizes a continuous scale of rating between zero and five to describe users preferences.
The task of this assignment is to design the structure of the database for a startup company that would allow the storage of user’s preferences.
Submit a Word document with tables (one for each database table) that lists the following:
· Field name
· Field type (use MySQL data types (Links to an external site.))
· A comment on the role of the field
In order to complete the assignment, you will need to identify the number of tables that would efficiently store data collected by the startup company. And design the fields including the ones that would store ID values of other table(s) in order to ensure relations between tables. Please use arrows to identify the relations between table fields.
Here is an example of the design for the student enrollment database:
Unit 6: Coding Assignment
SQL statements allow us to retrieve, manipulate, or delete data stored in relational databases. Here are few examples of SQL statements:
The INSERT statement is used to insert data into a table: For example:
INSERT INTO `students (student_id`, `first_name`, `age`) VALUES (14, Melissa, 23);
The SELECT statement is used to retrieve data. For example, to get the list of students use:
SELECT * FROM `students`;
Where * means to return a table with all columns of the initial table.
You can limit the output columns:
SELECT `first_name` FROM `students`;
To use a condition, you can add a WHERE statement
SELECT * FROM `students` WHERE student_id = 12;
If you need to aggregate information in the table, you can use a function like MAX, or AVG for average, or COUNT.
For example, if you need to calculate an average students age, you would use this fucntion:
SELECT AVG(`age`) FROM `students`;
The DELETE statement can be used to delete data. Note that if no WHERE conditions are given all data from the table will be deleted.
For, example, to delete all re-enrollment records for a student with id equal to 14:
DELETE from `enrollment` WHERE `student_id`=14
For the database design in the design assignment for this week write an SQL script to:
· Insert two a new user;
· Retrieve the list of places in a given category;
· Find the number of ratings submitted by a given user;
· Delete all preferences submitted by a user with a given ID = 342
Submit your script to the dropbox as a text document.
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."