| COMP3311 Final Exam 21T3 |
The University of New South Wales COMP3311 Database Systems Final Exam 21T3 |
Database Systems |
Write an SQL view that gives a list of how many unsold properties of each type are in each suburb.
Define the view as q2(suburb,ptype,nprops), where the attributes are:
The output should be ordered by property type, and then by suburb. What the output should look like:
property=# select * from q2;
suburb | ptype | nprops
----------------+-----------+--------
Alexandria | Apartment | 42
Bondi Junction | Apartment | 41
Coogee | Apartment | 47
Kingsford | Apartment | 43
Alexandria | House | 34
Bondi Junction | House | 38
Coogee | House | 38
Kingsford | House | 36
Alexandria | Townhouse | 9
Bondi Junction | Townhouse | 9
Coogee | Townhouse | 6
Kingsford | Townhouse | 9
(12 rows)
Instructions: