数据库原理 Exercises 1

本文最后更新于:2022年5月16日 上午

Database System Concepts Exercises of Chapter 2

Database System Concepts Exercises of Chapter 2

Exercise 2.1 Consider the relational database of Figure 2.14,

Employee( person_name, street, city) Works (person_name, company_name, salary) Company(company_name, city) Figure 2.14

What are the appropriate primary keys?

My answer:

\(employee (\underline{person-name}, street, city)\)

$works (, company-name, salary) $

\(company (\underline{company-name}, city)\)

Exercise 2.7 Consider the relational database of Figure 2.14. Given an expression in the relational algebra to express each of the following queries:

a.Find the names of all employees who live in city “Miami”

b.Find the names of all employees whose salary is greater than $100,000.

c.Find the names of all employees who live in “Miami” and whose salary is greater than $100,000.

My answer:

Exercise 2.9 Consider the bank database of Figure 2.15.

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, loan_number) depositor(customer_name, account_number) Figure 2.15

  1. What are the appropriate primary keys?

  2. Given your choice of primary keys, identify appropriate foreign keys. Assume that branch names and customer names uniquely identify branches and customers, but loans and accounts can be associated with more than one customer.

My answer:

The primary keys are marked with an \(\underline{underline}\), and the foreign keys are marked with a \(\overline{overline}\).

\(branch(\underline{branch-name}, branch-city, assets)\)

\(customer(\underline{customer-name}, customer-street, customer-city)\)

\(loan(\underline{loan-number}, \overline{branch-name}, amount)\)

\(borrower(\overline{\underline{customer-name}}, \overline{loan-number})\)

\(account(\underline{account-number}, loan-number)\)

\(depositor(\overline{\underline{customer-name}}, \overline{account-number})\)


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!