Prin - and App - of Database Homework 02
Prin - and App - of Database Homework 02
2 Consider the foreign key constraint from the dept name attribute of
instructor to the department relation. Give examples of inserts and deletes
to these relations, which can cause a violation of the foreign key
constraint.
Answer:
• Inserting a tuple:
(10111, Ostrom, Economics, 110,000)
into the instructor table, where the department table does not have the
department Economics, would violate the foreign key constraint.
• Deleting the tuple:
(Biology, Watson, 90000)
from the department table, where at least one student or instructor tuple has
dept name as Biology, would violate the foreign key constraint.
This study source was downloaded by 100000814636672 from CourseHero.com on 08-07-2022 01:54:12 GMT -05:00
No. For this possible instance of the instructor table the names are unique, but
1/3
https://www.coursehero.com/file/159614174/Prinand-Appof-Database-Homework-02doc/
2.9 Consider the bank database of Figure 2.15.
a. What are the appropriate primary keys?
b. Given your choice of primary keys, identify appropriate foreign
keys.
Answer:
2.10 Consider the advisor relation shown in Figure 2.8, with s_id as the
primary key of advisor. Suppose a student can have more than one
advisor. Then, would s_id still be a primary key of the advisor relation?
If not, what should the primary key of advisor be?
Answer:
This study source was downloaded by 100000814636672 from CourseHero.com on 08-07-2022 01:54:12 GMT -05:00
2/3
https://www.coursehero.com/file/159614174/Prinand-Appof-Database-Homework-02doc/
From the figure 2.8, a database schema, along with primary key and foreign
key dependencies, can be depicted by schema diagrams. It’s showing the
schema diagram for our university organization. Each relation appears as a
box, with the relation’s name at the top in blue, and the attributes listed
inside the box. Primary key attributes are shown underlined. Foreign key
dependencies appear as arrows from the foreign key attributes of the
referencing relation to the primary key of the referenced relation.
So, only with s_id as a primary key of advisor will not be possible if there
is more than one advisor. At that time, we also have to select the s_id and
i_id as a primary key. If we just choose only the s_id then there will be a
conflict.
This study source was downloaded by 100000814636672 from CourseHero.com on 08-07-2022 01:54:12 GMT -05:00
3/3
https://www.coursehero.com/file/159614174/Prinand-Appof-Database-Homework-02doc/
Powered by TCPDF (www.tcpdf.org)