Download Exercise 02: Introduction to Relational Databases (Entity and

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Concurrency control wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
Exercise 02: Introduction to Relational Databases (Entity and Referential Integrity)
The questions (1 and 2) are on the third page of this assignment. Be sure to have at the top of
each file (a) Your Full Name, Username, and Date (b) questions and answers. You can copy and
paste question into the file. We do not need the diagrams and introductory statements, but at
least the questions should be there.
Note:
MySQL comments can be done with /* */ for multiline-comments (as in Java), or with –
(yes, two dashes) for single line comments. Java uses // for single line comments.
Lecturer/Author: K G Osafo-Maafo
Teaching Assistant: Abdul Iddris
Disclaimer:
The database comes from the Ullman-Widom textbook. We are using their database schema for
this assignment. A scan of some parts of their text was used. We only wrote out the question
asking students to do specific things.
Chapter 2 of your textbook provides the following “example” database schema for movies. The natural
language descriptions for each of the tables is in chapter 2.
Chapter 4 presents the following High-Level Entity-Relationship Diagram for the database in chapter 2.
Question 1:
Chapter 4 diagram provides an ER (entity relationship diagram for a movie database). Draw the
diagram in chapter 4 (snapshot in on previous page, reproduced below). Save your file as
question1answer.dia, and export a png image of the file as question1answer.png
Question 2:
Consider how the diagram from chapter 4 was done. You can see how entities, entity attributes,
and relationships are represented. Consider the 5 tables in chapter 2 (Movies, MovieExec,
MovieStar, Studio, StarsIn). Integrate the entities and relationships captured by tables from
chapter 2. Update the design of the diagram to capture the extra information in the tables. Save
your file as question2answer.dia, and export a png image of the file as question2answer.png
Question 3:
Modify your database design from chapter 2 to include PRIMARY KEYS, and FOREIGN KEYS as
necessary. The primary keys are underlined. You can easily tell what the foreign keys are. Please
do not add in any AUTO_INCREMENT IDS yet. Simply follow the keys provided.
Please remember to make a new database (CREATE DATABASE mynewdatabase;) and use that
database (USE DATABASE mynewdatabase;) before running the new queries. Please take a look
at the slides from Monday to see an example for primary key and foreign key.
Look at the diagram you have from question 2? If there are more entities or relationships that
need tables, please add them to your design. If no key is specified, pick a column suitable for the
key.
Save your database create script file as question3_create.sql
Save your database insertion script file as question3_insert.sql
Question 4:
Use the MySQL workbench database design diagram tool to implement the tables you created in
Question 3. Be sure to put links between the columns. *We will demonstrate how to use the
workbench diagram in class. You diagram file should be called question4diagram and you
should export a PNG of the diagram and call it question4image.png . Depending on your version
of workbench, your extension may vary for the diagram. However, when you export, I want you
to make a png.
Question 5:
Select a movie database website. It can be something that you have used, or if you have not
used one you can go and find one by doing a google search.
a) What is the name of the website that you have selected?
b) What are some of the features of the website that you like?
c) What are some of the features of the website that you believe you database can currently
support if you added extra attributes or columns? (i.e. what tables do you have that already
can contain some of the information on the website)
d) What are some of the features of the website that you do not have tables for and will need
to create tables for?
Answer the questions and put in a file called question5answers.txt