1 / 8

CSCI 4370/6370 Solutions to Test 1

CSCI 4370/6370 Solutions to Test 1. (Dan Everett’s version). Database for Ch 1 and Ch 5 Q’s. Parcel (routingNum, from, fAddress, fPhone, to, tAddress, tPhone, sendDate, cost) Truck ( truckNum , driver, homeBase) Tracking ( routingNum, truckNum , pickUpDate, pLocation, dropOffDate, dLocation).

Download Presentation

CSCI 4370/6370 Solutions to Test 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 4370/6370Solutions to Test 1 (Dan Everett’s version)

  2. Database for Ch 1 and Ch 5 Q’s • Parcel (routingNum, from, fAddress, fPhone, to, tAddress, tPhone, sendDate, cost) • Truck (truckNum, driver, homeBase) • Tracking (routingNum, truckNum, pickUpDate, pLocation, dropOffDate, dLocation)

  3. Ch. 1 Q: relational algebra SQL> select cost, sendDate from parcel where from=‘John Smith’ Result = πcost, sendDate (σfrom=‘John Smith’ Parcel)

  4. Ch 3 Q: Relation terminology • “Draw a sample relation consisting of 5 3-tuples. Label the diagram to illustrate what a relation (in general) is built out of.”

  5. Ch 5 Q: relational algebra queries • “Which truck does Pikup Andropov drive?” πtruckNum (σdriver=‘Pikup Andropov’ truck)

  6. Ch 5 Q: relational algebra queries • “Track John Smith’s package sent 2005-06020 by listing all the drivers that have picked up his package and when they picked it up and dropped it off” πdriver, pickUpDate, dropOffDate ((σfrom=‘John Smith’ parcel)ΙXΙ(truck ΙXΙ tracking))

  7. Explanation: (truck ΙXΙ tracking) = (truckNum, routingNum, driver, homeBase, pickUpDate, pLocation, dropOffDate, dLocation) parcel ΙXΙ(truck ΙXΙ tracking) = (truckNum, routingNum, from, fAddress, fPhone, to, tAddress, tPhone, sendDate, cost, driver, homeBase, pickUpDate, pLocation, dropOffDate, dLocation)

  8. Ch 5 Q: relational algebra queries • “When was John Smith’s package delivered?” πdropOffDate (σ dLocation=tAddress andfrom=‘John Smith’ (parcel ΙXΙ(truck ΙXΙ tracking))) -or- πdropOffDate (σ dLocation=tAddress(σfrom=‘John Smith’ parcel) ΙXΙ(truck ΙXΙ tracking)))

More Related