List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:November 11 2008 7:53am
Subject:Re: Primary key / foreign key question
View as plain text  
Hello Steve,

> Ok, I'm a little new a this, so be gentle!! :)
> I was looking into the InnoDB engine for some tables I have, and would
> to use the PK/FK on some of the data.
> It appears that the PK/FK is mainly used for updating/deleting data,
> correct?  I can't use it to retreive data from multiple tables and have
> linked, other than a join?  Or am I wrong?

It's mainly used for generating exceptions when the data is about to
become invalid if you delete something that is used by another table.
You can set it to automatically delete "child"-data or prevent these
deletions so that the data in your database stays consistent.

When retrieving data, you need to JOIN tables yourself into a result set.

Alternatively, you can create a server side object called a VIEW that
is basically a result set that looks like a single table.

> Is there a good visual tool that I can use to build my tables, create the
> PK/FK definations, and test how inserts, deletes, updates affect all the
> tables involved??

What OS? For example, on Windows, we offer a free Lite version of
our developer tool "Database Workbench".

Martijn Tonies
Database Workbench Lite for MySQL - FREE developer tool for MySQL!
Upscene Productions
My thoughts:
Database development questions? Check the forum!

Primary key / foreign key questionSteve Grosz11 Nov
  • Re: Primary key / foreign key questionMartijn Tonies11 Nov