[thelist] Learning SQL
Michiel Trimpe
info at juvex.com
Tue, 4 Jan 2000 22:24:11 +0100
Well if you want a short explanation.
Foreign Keys are fields of a database that "link" to another database.
Let's assume that each table starts with the ID row, which is unique
generally A Good Thing (tm) ).
You start out with the table Departments, being :
ID | Name | Location
Now you would have a second table called Employees, being :
ID | Name | Tel | Fax | etc... | DepartmentID
And voila, here DepartmentID is your foreign key. It "tells" you that person
ID belongs to deparment DepartmentID .
The thing about Foreign Keys, as you've mentioned is that this relation can
also hard-coded into the database structure.
You could imagine for example, that giving a non-existing Department ID to
DepartmentID would be an error.
If you define these critters in the Database Structure you can prevent this
kind of "error" from occuring. In other words assigning an incorrect ID will
return a simple error.
mSQL & MySQL do _not_ support this, Oracle _does_ and I don't _know_ about
MS SQL and other SQL servers.
Mike
----- Original Message -----
From: Martin <martin@members.evolt.org>
To: <thelist@lists.evolt.org>
Sent: Tuesday, January 04, 2000 8:15 PM
Subject: Re: [thelist] Learning SQL
> On Mon, 03 Jan 2000, Mike wrote:
> > One additional note here,
> >
> > MySQL does _not_ support foreign keys.
> >
> > _nor_ does it support transactions.
> You see - this is why I need to know ;-) Seriously, several people have
> commented on how important these things are, but I haven't a clue. And as
I
> want to get more into CF this year, I think it's important.
>
>
> > ----- Original Message -----
> > From: Oliver Lineham <oliver@lineham.co.nz>
> > >
> > > You might find this link useful:
> > > http://docs.rinet.ru:8081/SQL-3w/
> > > QUE/MCP's "Teach Yourself SQL in 21 Days, Second Edition" - the entire
> > book
> > > available for download on the Web.
> > >
> > > I'm not sure if this is legal or what. Who would OCR a whole book?
> Almost certainly not. They had the cheek to include the copyright notices
too...
>
>
> >There
> > > are lots of these entire books available for download at various
> > > places.
> That site has *loads* - very dodgy. Mind you, you'll use a ream of paper
> printing each one out...
>
> Cheers
> Martin
> --
> Alternative addresses:
> martin@easyweb.co.uk
> martin.burns@rbs.co.uk (daytime)
> Your current problems are explained by:
> Mail server hit by UniSpammer.
>
> _______________________________________________________
> unsubscribe+options: http://lists.evolt.org/mailman/listinfo/thelist
> tip harvester: http://lists.evolt.org/harvest/
> email archive: http://lists.evolt.org/archive/
> http://evolt.org/ Workers of the Web, evolt !
>