



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Problem 1 (15 points) Misc. Concepts For each of the following statements, indicate whether it is TRUE or FALSE by circling your choice. You will get 1 point for each correct answer, -0.5 point for each incorrect answer, and 0 point for each answer left blank.
(1) T rue F alse The relational data model was proposed by Dr. Edgar Codd in early 1970’s. (2) T rue F alse Schema normalization not only reduces potential data redundancy but also enhances query efficiency. (3) T rue F alse SQL stands for Structured Query Language. (4) T rue F alse Any relationship satisfying referential integrity constraint will satisfy single value constraint as well. (5) T rue F alse A schema in BCNF will be in 3NF as well. (6) T rue F alse If A → B and C → D hold, then AC → BD also holds. (7) T rue F alse Given a relation with attributes A, B, C, D, E : if AB → C, BC → AD, and D → E hold, then AB is a key. (8) T rue F alse A multivalued dependency A B implies functional dependency A → B. (9) T rue F alse SQL is a declarative query language, in which we simply declare what we want, but not how to compute, in formulating a query. (10) T rue F alse With the six basic operations (union, difference, selection, projection, product, and renaming), relational algebra is Turing complete. Other operations are just syntactic sugar and can be derived from the basic operations. (11) T rue F alse In SQL, a view can be used like a stored relation in any operations. (12) T rue F alse In SQL, the value NULL is ignored in any aggregation. (13) T rue F alse For any SQL query, there exists a unique translation into relation algebra.
Problem 2 (20 points) ER and Schema Design Consider the following E/R diagram:
(a) For each of the following statement, write a functional dependency (FD) that best captures the statement. (6 points)
(b) From the E/R diagram and the set of FDs you listed above, can you derive new FDs? If no, explain why not. If yes, derive such new FDs– give as many an you can, but no more than three. (6 points)
(c) Now suppose the FDs you specified above are true. Translate this diagram into a relational schema in BCNF. (8 points)
Problem 4 (20 points) Views and Constraints Consider the following relational schema: Account(accountNumber, branchName, balance) Branch(branchName, street, city, assets) Customer(customerSSN, street, city) Deposit(customerSSN, accountNumber, Amount) (a) List all the attributes (in the four tables) that are foreign keys and indicate what attributes they are referencing. (4 points)
(b) Define a view BigBranch that gives for each branch its branchName, city, and assets. The branch should have more than 50 accounts and the total balance of all accounts is greater than $1,000,000. (8 points)
(c) Suppose we want to check that, for each branch, the total balance of all accounts is less than or equal to the assets of the branch. Complete the following SQL statement, by specifying 〈condition〉. Note, by definition, such an “assertion” statement will enforce the 〈condition〉 to hold true at all times. (8 points) CREATE ASSERTION BalanceCheck CHECK 〈condition〉