Dina, I'm going to throw this "Teach Yourself SQL" book in the rubbish bin,
and buy your book instead.  You can explain how clever I already am in such
concise terms.


What's the name of your book?


Thanks for your help folks.   Now I know where I have to go reading next.


Cheers,
Mike Kear
Windsor, NSW, Australia
AFP WebWorks


-----Original Message-----
From: Dina Hess [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 29 September 2002 2:35 AM
To: SQL
Subject: Re: Why External keys?

> Actually there was no problem.   I just saw the terms "primary
key" and
> "foreign key"  and wasn't clear on what they meant.   I have
seen table
> layouts where people have a table just containing keys and
couldn't figure
> out why.

A primary key is just a unique identifer for a table record.
A foreign key is the primary key of one table included as a field
in another table to establish a relationship between the two
tables.
Sometimes it's necessary to create what's known as an
intersection table if the relationship between two tables is
many-to-many. That type of table could well include only the keys
from the other two tables.

> So you are saying that my query is actually an INNER JOIN??
That was the
> next thing I had to come to grips with - Inner and outer joins.
I've read
> the part in the SQL book I have where it explains what inner
and outer joins
> are and its been double-dutch to me the first 5 times through.

Yes, you are doing an inner join using Transact-SQL syntax.
An inner join will only return records from the joined tables
that have matching primary/foreign keys.
An outer join will return *all* records from the starting table
regardless of whether or not there are matching primary/foreign
keys.




______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to