ICS 6B
Fall 2013
Homework 7


Due: Wednesday, Nov 20

Covers Sections 3.6

  1. Which 4-tuples are in the relation {(a, b, c, d): a, b, c, d are positive integers and abcd=6}?

  2. List the tuples in the relation {(a, b, c): a, b, and c are positive integers and 0 < a < b < c < 5}.

  3. Consider the following small database whose records correspond to flights departing from an airport.

    Airline Flight number Gate Destination Departure time
    FlyRight 122 34 Detroit 08:10
    JetGreen 221 22 Denver 08:17
    JetGreen 122 33 Anchorage 08:22
    JetGreen 323 34 Honolulu 08:30
    FlyRight 199 13 Detroit 08:47
    JetGreen 222 22 Denver 09:10
    FlyRight 322 34 Detroit 09:44

    1. Are the attributes Airline and Destination a key for this database?
    2. Give examples of two separate sets of attributes that are keys for this database
    3. Show the results of the operation SELECT[Airline="JetGreen" ∧ Destination="Denver"]
    4. Show the results of the operation PROJECT[ Airline, Gate ]
    5. Show the results of the operation SELECT[Destination="Denver"] followed by Project[Gate]
    6. What operation or operations should be performed if you wanted to know which airlines use gate 22?
    7. What operation or operations should be performed if you wanted to know whether there are any flights to Detroit departing before 9:10?

  4. The table below shows the database of course offerings for the Computer Science Department for the current academic year. It's actually just a portion of the course offerings, but for the purposes of this question, assume it lists all the courses.

    Course number Course title Instructor Quarter
    CS 111 Digital Image Processing Majumder Spring
    CS 112 Computer Graphics Majumder Spring
    CS 117 Project in Computer Vision Fowlkes Fall
    CS 116 Computational Photography & Vision Fowlkes Winter
    CS 122A Introduction to Data Management Carey Spring
    CS 122A Introduction to Data Management Li Winter
    CS 122C Principles of Data Management Carey Winter

    1. Give a key for this database.
    2. Show the results of the operation SELECT[Course number = "CS122A" ∨ Course number = "CS122C"]
    3. Show the results of the operation PROJECT[ Instructor ]
    4. Show the results of the operation SELECT[Quarter="Spring"] followed by Project[Course number]. Express in English what question this combination of queries is asking.
    5. What operation or operations should be performed if you wanted to know which quarters CS 122A is being offered?
    6. What operation or operations should be performed if you wanted to know which courses are being taught by Prof. Majumder?