# 数据库CH (2)

8Chapter2Introduction to the Relational Model

b.Given your choice of primary keys,identify appropriate foreign keys.

a.The primary keys of the various schema are underlined.Although

in a real bank the customer name is unlikely to be a primary key,

since two customers could have the same name,we use a simpliﬁed

schema where we assume that names are unique.We allow customers

to have more than one account,and more than one loan.

branch(branch name,branch city,assets)

customer(customer name,customer street,customer city)

loan(loan number,branch name,amount)

borrower(customer name,loan number)

account(account number,branch name,balance)

depositor(customer name,account number)

b.The foreign keys are as follows

i.For loan:branch name referencing branch.

ii.For borrower:Attribute customer name referencing customer and

loan number referencing loan

iii.For account:branch name referencing branch.

iv.For depositor:Attribute customer name referencing customer and

account number referencing account

2.10Consider the advisor relation shown in Figure2.8,with s id as the primary

would s id still be a primary key of the advisor relation?If not,what should

the primary key of advisor be?

Answer:No,s id would not be a primary key,since there may be two(or

more)tuples for a single student,corresponding to two(or more)advisors.

The primary key should then be s id,i id.

2.11Describe the differences in meaning between the terms relation and relation

schema.

Answer:A relation schema is a type deﬁnition,and a relation is an instance

of that schema.For example,student(ss#,name)is a relation schema and

123-456-222John

234-567-999Mary

is a relation based on that schema.

2.12Consider the relational database of Figure2.14.Give an expression in the

relational algebra to express each of the following queries:

a.Find the names of all employees who work for“First Bank Corpora-

tion”.

（共4页）