




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Database Systems; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Fall 2003;
Typology: Exams
1 / 8
This page cannot be seen from the preview
Don't miss anything!





CS 311 Introduction to Database Management Systems Department of Computer Science University of Illinois at Urbana-Champaign
Name:
1. (24 points; 2 points each) Multiple choice questions: For each of the following statements or questions, circle the correct answer.
3. (20 points) Schema Refinement:
Consider the following relation and dependencies: R(A, B, C, D, E, F), A B, A C, BC A, D EF, F E. Assume the above functional dependencies are the only ones that hold over R. Identify whether R is in BCNF or 3NF or neither. If R is not in BCNF, decompose R into a collection of BCNF relations. Please show each step of the decomposition process.
4. (20 points; 5 points each) Relational Algebra and SQL:
Consider the following database schema: Product(name, manf, category) manf = the manufacturer of the product Store(name, city) Sell(store-name, prod-name, price) Buy(buyer-name, prod-name, store-name, date, quantity)
(a) Write a query in relational algebra that returns the name and price of all products being sold at the stores where "John" has ever purchased some product. (For example, if "John" has ever bought a product at a store named BestBuy, then the result of executing the query should include the name and price of all products being sold at BestBuy.)
(b) Write a SQL query that returns the names of all pairs of "VCR" and "TV" products by the same manufacturer. Note that "VCR" and "TV" are product categories. (For example, suppose Sony manufactures three “VCR” products named VCR1, VCR2, and VCR3. Suppose Sony also manufactures two “TV” products named TV1 and TV2. Then the query result should include the pairs (VCR1, TV1), (VCR1, TV2), (VCR2, TV1), and so on.
5. (16 points; 8 points each) Views:
Consider the view:
CREATE VIEW Champaign-purchase AS SELECT buyer-name, prod-name , date FROM Store, Buy WHERE Store.city = "Champaign" AND Store.name = Buy.store-name
This view is defined over the relational schema of Problem 4.
(a) Is this view updateable? Please explain your answer.
(b) Suppose we add store-name to the SELECT clause of the above view, so now the view is
CREATE VIEW Champaign-purchase AS SELECT store-name, buyer-name, prod-name , date FROM Store, Buy WHERE Store.city = "Champaign" AND Store.name = Buy.store-name
Is this view updateable? Please explain your answer.