

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
This course is intended to give students a solid background in databases, with a focus on relational database management systems. Topics include data modeling, database design theory, data definition and manipulation languages, storage and indexing techniques, query processing and optimization, concurrency control and recovery, and database programming interfaces. In addition to these traditional topics, this course covers a sample of emerging topics such as XML and Web data management as well a
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CPS 116 Fall 2004 Supplemental Problem Set # (Not due; for use as optional additional exercises)
Problem 1.
An airline database contains the following tables:
The Employee table describes pilots as well as other types of employees. Employees who are certified to operate on some aircraft are considered pilots. Run /home/dbcourse/examples/db-flights/setup.sh to setup a database with some sample data. For the SQL database schema, please refer to the file create.sql in the same directory. Write SQL statements to answer the following queries.
(a) Find the names of aircraft such that all pilots certified to operate them earn more than $80,000. (b) Find the names of pilots whose salary is less than the price of the cheapest direct flight from Los Angeles to Honolulu. (c) Find the names of pilots certified for some Boeing aircraft. (d) Find the aid’s of all aircraft that can be used to fly from Los Angeles to Chicago. (e) A customer wants to travel from Madison to New York with no more than two changes of flight. List the choice of departures from Madison if the customer wants to arrive at New York by 6pm. (f) Print the name and salary of every non-pilot whose salary is more than the average salary for pilots. (g) Print the names of employees who are certified only for aircrafts with cruising range longer than 1000 miles.
Problem 2.
Which queries in Problem 2 cannot be formulated in basic relational algebra? For relational algebra, assume that selection and join conditions may use built-in SQL predicates on strings, times, etc., but no SQL aggregation functions are allowed.
Problem 3.
Consider a relation R ( A , B , C , D ) with FD’s AB → C , C → D , and D → A.
(a) Show that { A , B } is a key of R (remember a key has to be minimal). (b) What are the other keys of R? (Hint: B must be in every key of R ; why?) (c) D → A is a BNCF violation. Using this violation, we decompose R into R 1 ( A , D ) and R 2 ( B , C , D ). What are the keys of R 1?
(d) What are the FD’s that hold in R 1? Do not list them all; instead, give a set of FD’s from which all other FD’s in R 1 follow. This set of FD’s is called a basis. When checking for BCNF violations, it suffices to check just the basis. (e) Is R 1 in BCNF? Briefly explain why. (f) What are the keys of R 2? (Hint: There is more than one.) (g) What are the FD’s that hold in R 2? Again, do not list them all; instead, give a basis. (h) Is R 2 in BCNF? If yes, briefly explain why. Otherwise, decompose further until all decomposed relations are in BCNF, and then show your final results.
Problem 4.
Using the chase procedure to prove or disprove the following claims.
(a) In a relation R ( A , B , C , D ), if A BC , then A B. (b) In a relation R ( A , B , C , D ), if A B and A → C , then A D.