Connecting Tech Pros Worldwide Forums | Help | Site Map

Relationships between tables

Paradigm
Guest
 
Posts: n/a
#1: Jul 23 '05
I am new to MYSQL (been working with Access for years and now seen the
light). One thing I cannot get sorted is how to create relationships between
my SQL tables.
Can someone point me in the right direction.
Alex



Bill Karwin
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Relationships between tables


Paradigm wrote:[color=blue]
> I am new to MYSQL (been working with Access for years and now seen the
> light). One thing I cannot get sorted is how to create relationships between
> my SQL tables.[/color]

The usual way in SQL databases is to use foreign keys, with the
REFERENCES syntax to declare referential integrity and cascading
constraints.

One non-obvious piece of information that you'll need is that in MySQL,
the default table type (MyISAM) does not enforce referential integrity,
but another table type available in MySQL (InnoDB) does support this.
Read these pages for more information:

http://dev.mysql.com/doc/mysql/en/ex...eign_keys.html
http://dev.mysql.com/doc/mysql/en/In...nstraints.html
http://dev.mysql.com/doc/mysql/en/AN...eign_Keys.html

Regards,
Bill K.
Closed Thread