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

Contents of /uni/COMP2400/q8.sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Wed Aug 11 22:48:11 2004 UTC (20 years, 2 months ago) by apollock
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
Base questions ready for submission

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 -- Report the Names and CountryOfBirth of persons who married someone born in a country different from their own.
8
9 TTITLE "COMP2400: Assignment 1: Question 8|Andrew Pollock (4137129)"
10
11 --COLUMN FIRSTNAME HEADING 'Firstname'
12 --COLUMN SURNAME HEADING 'Surname'
13 COLUMN NAME HEADING 'Name'
14 COLUMN COUNTRYOFBIRTH HEADING 'Birth Country'
15
16 SELECT INITCAP(p.firstname || ' ' || p.surname) AS Name, countryofbirth
17 FROM person p JOIN marriage m ON (m.wifeid = p.personid)
18 WHERE p.countryofbirth != (
19 SELECT p2.countryofbirth
20 FROM person p2 JOIN marriage m2 ON (m2.husbandid = p2.personid)
21 WHERE m2.wifeid = m.wifeid
22 )
23 UNION
24 SELECT INITCAP(p.firstname || ' ' || p.surname) AS Name, countryofbirth
25 FROM person p JOIN marriage m ON (m.husbandid = p.personid)
26 WHERE p.countryofbirth != (
27 SELECT p2.countryofbirth
28 FROM person p2 JOIN marriage m2 ON (m2.wifeid = p2.personid)
29 WHERE m2.husbandid = m.husbandid
30 );
31
32 EXIT;

  ViewVC Help
Powered by ViewVC 1.1.22