1 |
apollock |
1.1 |
-- I have read the ANU Code on "Academic Honesty in Learning and Teaching", |
2 |
|
|
-- and I declare that, except where appropriately attributed, the content |
3 |
|
|
-- of the file I have submitted for this assignment is entirely my own |
4 |
|
|
-- work. It has not been produced, in whole or in part, by another person. |
5 |
|
|
-- (signed) Andrew Pollock 4137129 |
6 |
|
|
|
7 |
apollock |
1.3 |
-- Find the couple(s) with the most children |
8 |
|
|
|
9 |
apollock |
1.2 |
TTITLE "COMP2400: Assignment 1: Question 6" |
10 |
|
|
|
11 |
apollock |
1.4 |
COLUMN Mother HEADING "Mother" |
12 |
|
|
COLUMN Father HEADING "Father" |
13 |
|
|
|
14 |
|
|
SELECT mother.firstname || ' ' || mother.surname AS Mother, father.firstname || ' ' || father.surname AS Father |
15 |
|
|
FROM parents p, person mother, person father |
16 |
|
|
WHERE p.motherid = mother.personid |
17 |
|
|
AND p.fatherid = father.personid |
18 |
|
|
GROUP BY mother.firstname, mother.surname, father.firstname, father.surname |
19 |
|
|
HAVING COUNT(p.personid) = (SELECT MAX(COUNT(personid)) |
20 |
|
|
FROM parents |
21 |
|
|
GROUP BY motherid, fatherid); |
22 |
apollock |
1.2 |
|
23 |
|
|
EXIT; |