database question

timer Asked: Apr 13th, 2016

Question description

Consider the following relations :

Driver(did : integer, name : string, age : integer)

Result(did : integer, teamid : integer, place : integer, race : integer)

Test(did : integer, teamid : integer, testdate : date, circuit : string)

Team(teamid : integer, tname: string)

The meaning of the relations is straightforward. Result indicates which driver, running for which team finished in what place. Test indicates which driver is/was scheduled to test for which team.

Write the following queries in relational algebra, domain relational calculus and SQL. No duplicates should be printed in the results. If some queries cannot be expressed in relational algebra or calculus, explain the reason.

1. Find the names of all drivers that scored a podium finish (i.e. finished at least 3rd). (10 pts)

2. Find the name of the oldest driver who either won a race or tested for team ‘Alpha’.

(10 pts)

3. Find the names of all the teams that either won a race or tested at least 5 different drivers. (10 pts)

4. Find the names of the drivers who are scheduled to test for 2 different teams on the same day. (10 pts)

5. Find the names of the drivers who tested for team ‘Alpha’ and no other team. (10 pts)

6. Find the names of the drivers who tested for every team at least once. (10 pts)

7. Find the names of the teams who tested on every circuit where a test ever took place.

(10 pts)

8. For each position from 1 to 3 find the average age of the drivers that finished in that position. (10 pts)

9. Find the names of the drivers that never finished a race. (10 pts)

10. For each team, find its highest finishing position in a race. (10 pts)

Tutor Answer

(Top Tutor) Studypool Tutor
School: University of Virginia
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors