Unit 6: Design Assignment
Introduction
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.
Directions
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
Introduction
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
Directions
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.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more