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’.
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.
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