CS348 Midterm: Midterm Solution of Fall 2009 Fall 2009 Solution only

177 views2 pages

Document Summary

Relational algebra: take the cross product of the pickup table with itself and ensure two di erent reservations exist from the same customer. Solu- tions that assumed that a dropo entry was required were given full credit as well. (p 2, (cnum : cnum2, rnum : rnum2), p ickup) (t woremtals, cnum( cnum=cnum2 rnum(cid:54)=rnum2(p 1 p 2))) Sql: solutions can use the technique similar to the relational alegbra ex- pression or use the aggregate functions provided by sql: From customer inner join pickup on pickup. cnum = customer. cnum. Relational algebra: currently renting implies that there should be an entry for the customer in the pickup table but not in the dropo table: Answer: cnum,cname(p ickup (cid:46)(cid:47) currentrentals (cid:46)(cid:47) w aterloocustomers (cid:46)(cid:47) Sql: use not exists / except or similar clauses to get eliminate pick- ups that do not exist in the dropo table: And pickup. rnum not in (select rnum from dropo ) Where car. license not in (select license from pickup)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers