图3-1-3:关系模型与程序设计语言中数据类型的类比

��Account-schema = (branch-name, account-number, balance)而用account(Account-schema)表示account是Account-schema上的关系。在这里,关系account就相当于关系模式Account-schema的一个变量。所谓的数据库模式就是指类似Account-schema的定义。
��作为一个例子,先看一看关系branch,它的关系模式为:
Branch-schema = (branch-name, branch-city, assets),关系branch的具体内容如图3-1-4所示:

图3-1-4:关系branch(Branch-schema)
值得注意的是,属性branch-name既在模式Branch-schema中出现,又在Account-schema中出现。这样的重复非常重要,实际上,在关系模式中使用相同的属性正是将不同关系的元组联系起来的一种方法。
��为了今后讲课方便,我们把与银行有关的其他关系介绍如下,并且给出每个关系的具体内容。首先是关系
customer(Customer-schema):
Customer-schema = (customer-name, customer-street, customer-city)
需要说明的是:为了举例方便,这里假设属性customer-name是主码,而不像前面那样使用social-security属性。
图3-1-5:关系customer(Customer-schema)
关系depositor(Depositor-schema):
Depositor-schema = (customer-name, account-number)
图3-1-6:关系depositor(Depositor-schema)
关系loan(Loan-schema):
Loan-schema = (branch-name, loan-number, amount)
图3-1-7:关系loan(Loan-schema)
关系borrower(Borrower-schema):
Borrower-schema = (customer-name, loan-number)
图3-1-8:关系borrower(Borrower-schema)
��总之,根据图3-1-1和在第二章的2.9节讲述的基于E-R图将E-R模式转换为表的规则,我们得到了如下的关系模式:
Customer-schema = (customer-name, customer-street, customer-city)
Account-schema = (branch-name, account-number, balance)
Depositor-schema = (customer-name, account-number)
Branch-schema = (branch-name, branch-city, assets)
Loan-schema = (branch-name, loan-number, amount)
Borrower-schema = (customer-name, loan-number)