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

Diff of /uni/COMP2400/q7.sql

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

revision 1.1 by apollock, Sat Aug 7 11:07:01 2004 UTC revision 1.2 by apollock, Wed Aug 11 01:30:29 2004 UTC
# Line 1  Line 1 
1  -- I have read the ANU Code on "Academic Honesty in Learning and Teaching",  TTITLE "COMP2400: Assignment 1: Question 7"
 -- and I declare that, except where appropriately attributed, the content  
 -- of the file I have submitted for this assignment is entirely my own  
 -- work. It has not been produced, in whole or in part, by another person.  
 -- (signed) Andrew Pollock 4137129  
2    
3  SELECT fatherid as grandparent  COLUMN GRANDCHILD FORMAT A15 HEADING "Grandchild"
4  FROM parents  COLUMN GRANDFATHER FORMAT A20 HEADING "Grandfather"
5  WHERE personid in (  COLUMN GRANDMOTHER FORMAT A20 HEADING "Grandmother"
6  SELECT fatherid as parent  
7  FROM parents  BREAK ON GRANDCHILD
8  WHERE personid = '&1'  
9  UNION  SELECT child.firstname || ' ' || child.surname AS GrandChild, grandfather.firstname || ' ' || grandfather.surname AS grandfather, grandmother.firstname || ' ' || grandmother.surname AS Grandmother
10  SELECT motherid as parent  FROM parents p, person mother, person father, person child, person grandmother, person grandfather, parents p2, person grandchild
11  FROM parents  WHERE p.personid = child.personid
12  WHERE personid = '&1')  AND father.personid = p.fatherid
13  UNION  AND mother.personid = p.motherid
14  SELECT motherid as grandparent  AND p2.personid = grandchild.personid
15  FROM parents  AND grandfather.personid = p2.fatherid
16  WHERE personid in (  AND grandmother.personid = p2.motherid
17  SELECT fatherid as parent  AND (p2.personid = p.motherid OR p2.personid = p.fatherid)
18  FROM parents  AND p.personid = '&1';
19  WHERE personid = '&1'  
20  UNION  EXIT
 SELECT motherid as parent  
 FROM parents  
 WHERE personid = '&1');  

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

  ViewVC Help
Powered by ViewVC 1.1.22