0% found this document useful (0 votes)
59 views3 pages

Prin - and App - of Database Homework 02

The document discusses foreign key constraints and primary keys in database relations. It provides examples of inserts and deletes that could violate foreign key constraints. It also discusses when attributes can serve as primary keys, such as when names are unique identifiers for instructors. However, if a student can have multiple advisors, then student ID alone would not be a valid primary key for the advisor relation; both student and instructor IDs would be needed. The document also defines the difference between a relational schema and a relation.

Uploaded by

Fahim Muntasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views3 pages

Prin - and App - of Database Homework 02

The document discusses foreign key constraints and primary keys in database relations. It provides examples of inserts and deletes that could violate foreign key constraints. It also discusses when attributes can serve as primary keys, such as when names are unique identifiers for instructors. However, if a student can have multiple advisors, then student ID alone would not be a valid primary key for the advisor relation; both student and instructor IDs would be needed. The document also defines the difference between a relational schema and a relation.

Uploaded by

Fahim Muntasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2.

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.

2.4 In the instance of instructor shown in Figure 2.1, no two instructors


have the same name. From this, can we conclude that name can be used as
a super key (or primary key) of instructor?
Answer:

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:

a) A primary key is an attribute that uniquely identifies each tuple in the


database table/relation.
Here in Figure 2.15 branch_name, customer_name, loan_number,
account_number can be chosen as the appropriate primary key.

b) Here my choice Primary Key is branch_name.


Branch_city is the appropriate foreign key in branch_name.

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.

2.11 Describe the differences in meaning between the term’s relation


and relation schema.
Answer:
A database schema is a collection of meta-data that describes the relations
in a database. A schema can be simply described as the “layout” of a
database or the blueprint that outlines the way data is organized into tables.
Schema are normally described using Structured Query Language as a
series of CREATE statements that may be used to replicate the schema in a
new database.
Relational Schema refers to meta-data elements which are used to describe
structures and constraints of data representing a particular domain.
Whereas a relation is a property or predicate that ranges over more than one
argument.

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)

You might also like