/[cvs.andrew.net.au]/uni/COMP2400/q6.sql
ViewVC logotype

Diff of /uni/COMP2400/q6.sql

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by apollock, Tue Aug 10 01:28:52 2004 UTC revision 1.4 by apollock, Wed Aug 11 01:46:15 2004 UTC
# Line 4  Line 4 
4  -- work. It has not been produced, in whole or in part, by another person.  -- work. It has not been produced, in whole or in part, by another person.
5  -- (signed) Andrew Pollock 4137129  -- (signed) Andrew Pollock 4137129
6    
7    -- Find the couple(s) with the most children
8    
9  TTITLE "COMP2400: Assignment 1: Question 6"  TTITLE "COMP2400: Assignment 1: Question 6"
10    
11  SELECT motherid, fatherid  COLUMN Mother HEADING "Mother"
12  FROM parents  COLUMN Father HEADING "Father"
13  GROUP BY motherid, fatherid  
14  HAVING COUNT(personid) = (SELECT MAX(COUNT(personid))  SELECT mother.firstname || ' ' || mother.surname AS Mother, father.firstname || ' ' || father.surname AS Father
15                            FROM parents  FROM parents p, person mother, person father
16                            GROUP BY motherid, fatherid);  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    
23  EXIT;  EXIT;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22