COMP3311 Final Exam 22T3 The University of New South Wales
COMP3311 Database Systems
Final Exam 22T3
Database Systems
[Front Page] [Notes] [Database] [Course Website] [Cheat Sheets]
[Q1] [Q2] [Q3] [Q4] [Q5] [Q6] [Q7] [Q8] [Q9]

Question 1 (3 marks)

Write an SQL view that finds the horse (or horses) that have won the most Group 1 races.

Races are categorized into "groups". Group 1 races are the top level, most prestigious races. Then there are Group 2, Group 3 and Group 4 races. The Group of a race is indicated by the Races.level attribute. The position that a horse finishes in a race is indicated by the Runners.finished field, with a value of 1 meaning finished first.

Define the view as q1(horse).

The expected result is:

racing=# select * from q1;
   horse    
------------
 Brown Jack
(1 row)

Note that a "solution" which does something like   "select 'Brown Jack' as horse"   is worth zero marks.

Instructions:

End of Question