1.Consider the advisor relation shown in Figure 2.9, 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:Now s_ ID is not the primary key of the advisor relationship. Because a student can have multiple tutors, a student may be taught by multiple tutors. Advisor cannot be used to distinguish students. The primary key should be i_ id and s_ id;
(译:此时s_id不是导师关系的主键字段,因为一个学生可以有多个导师,所以一个学生可能会被多个导师教导,用导师无法区分学生,主码应该是i_id 和s_id。)
2. Consider the bank database of Figure 2.11.
a. What are the appropriate primary keys?
b. Given your choice of primary keys, identify appropriate foreign keys.
a.
Answer: schema primary key
Branch branch_name
Customer ID
Loan loan_number
Borrower ID/loan_number
Account account_number
Depositor ID/account_number
b.
Answer: I. For loan: branch_name referencing branch.
II. For borrower: Attribute ID referencing customer and loan_number referencing loan.
III. For account: branch_name referencing branch.
IV. For depositor: Attribute ID referencing customer and account_number referencing account.
(译文略)
3. List two reasons why null values might be introduced into the database.
Answer:When the exact value is unknown or does not exist, null values may be introduced.
(译:当确切值未知或不存在时,可能会引入空值。)
4. Discuss the relative merits of procedural and nonprocedural languages.
Answer: Nonprocedural languages greatly simplify the specification of queries(at least, the types of queries they are designed to handle).They free the user from having to worry about how the query is to be evaluated; not only does this reduce programming effort, but in fact in most situations the query optimizer can do a much better task of choosing the best way to evaluate a query than a programmer working by trial and error.
On the other hand, procedural languages are far more powerful in terms of what computations they can perfom. some tasks can either not be done using nonprocedural languages, or are very hard to express using nonprocedural languages, or execute very inefficiently if specified in a nonprocedural manner.
(译:非过程语言极大地简化了查询的规范(至少是它们设计用来处理的查询类型)。它们让用户不用担心如何评估查询;这不仅减少了编程工作量,而且事实上,在大多数情况下,查询优化器在选择最佳方式评估查询方面比程序员通过试错来完成的任务要好得多。
另一方面,过程语言在计算能力方面要强大得多。有些任务要么不能用非程序语言完成,要么很难用非程序语言表达,要么以非程序方式指定时执行效率很低。)
你以为?真的C!