In: Computer Science
Use only the operators discussed in class (select, project, Cartesian product, join, union, intersection, set difference and renaming). Type your answers.
The following database schema is given:
ATHLETE(name,age,height,weight,country)
RACE(id,location,date,time-start,distance)
COMPETES(aname,rid,time,position)
where ATHLETE has information about runners (their name, age, height, weight, and nationality); RACE has information about races (id, location, date when it’s held, time it starts, and distance ran); and COMPETES keeps track of which runners run on with race, the time it took them to complete the race, and their position on it (winner = ’1’, second = ’2’, third = ’3’, and so on).
(a) List the names of athletes under 30 years old from Norway that have ran a marathon (distance=26.2).
(b) List the names of athletes who have finished a race in 1st position and another race in second position.
(c) List the names of athletes who have never won a race (win=1st position).
(d) (*) List the races (id) where all the athletes were under 30 years old.