Index
Introduction
Single_Table_Queries
Sub-Queries
Union
Joins
Correlation
Miscellaneous
Conclusion
wOnKoSITE

 

Miscellaneous Examples

The Relations Database

Table: PEOPLE
this table lists general characteristic of people

Person Sex YrBorn Nationality
char(30) char(1) dec(4) Char(30)
NOT NULL NOT NULL  
KEY      

 

Table: FAMILY
this table lists the name of persons along with a parent
- both columns are foreign keys referencing Person in the People table

Parent Child
char(30) char(30)
NOT NULL NOT NULL
KEY KEY

 

Q: List Gina's Cousins
a family tree schematic
As this schematic, we can work from what we know (Gina's Parents) and work towards the children of gina's parents siblings... if that makes sense
Q: List Gina's Cousins - a JOIN Solution
ginas cousin - join version
  1. Can you write the query?
Q: List Gina's Cousins - A Correlated Solution
ginas cousin - correlated version 1

This correlated query is highly processor intensive

  1. Can you write this query?
  2. Can you formulate a different form of this query that still uses correlation but is a little less processor intensive?

  1. List people whose father had a different nationality to them
  2. List Fred's Aunts
  3. [watch this space]

 

 

 

 

 

pwhitehouse@optusnet.com.au
©Copyright 2006.
GOTO wOnKoSITE