文档库

最新最全的文档下载
当前位置:文档库 > 数据库CH (2)

数据库CH (2)

8Chapter2Introduction to the Relational Model

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

Answer:

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 simplified

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

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: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 definition,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”.

免费下载Word文档免费下载: 数据库CH (2)

(共4页)

数据库课程ch2 E-R模型

数据库课程ch2 E-R模型 - Chapter 2: Entity-Relationship Model 第章:实体-联系模型 ? Entity Sets实体集 ? Relationship...

ch2 数据库系统概念(第6版)第二章关系模型与关系代数

ch2 数据库系统概念(第6版)第二章关系模型与关系代数_工学_高等教育_教育专区。上海交通大学电院计算机系在职研究生的必修课程数据库 ...

数据库系统基础教程答案ch2

数据库系统基础教程答案ch2 - Exercise 2.2.1a For relation Accounts, the attributes are: acctNo, type, balance...

数据库chp7-2

ch8-2数据库系统原理及应用-存储过程 - 数据库系统原理及应用 SQLServer2005编程--存储过程 存储过程 存储过程 的 基本知识 创建用户 存储过程 存储过程 的参...