Page 37 - Discrete Structure II
P. 37
SQL (Structured Query Language) is a database query language
Consider the following SQL statement
SELECT Departure_time
FROM Flights
WHERE Destination=”Detroit”
Table 8 Flights
Airline Flight_number Gate Destination Departure_time
Nadir 122 34 Detroit 08:10
Acme 221 22 Denver 08:17
Acme 122 33 Anchorage 08:22
Acme 323 34 Honolulu 08:30
Nadir 199 13 Detroit 08:47
Acme 222 22 Denver 09:10
Nadir 322 34 Detroit 09:44
a. What are the operations that correspond to the query expressed using the SQL statement
above?
SELECT Departure clause corresponds to the projection P5 (Airline, Flight_number, Gate,
Destination, Departure_Time) = Departure_Time
WHERE Destination =”Detroit” clause corresponds to Selection operation Sc with the condition
c= “Destination=”Detroit”
FROM clause corresponds to the Join Operation
b. Result of the query
Departure_time
08:10
08:47
09:44
Exercise 2:
a. What do you obtain when you apply the projection p2, 3, 5 to the 5-tuple (a, b, c, d, e)?
b. Which projection mapping is used to delete the first, second and fourth components of a 6-
tuple?
Solution