View Single Post
  #10 (permalink)  
Old June 29th, 2004, 04:48 AM
Daniel Walker Daniel Walker is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to CREATE all your tables as TYPE=InnoDB. The traditional MyISAM data engine MySQL AB originally built dos not enforce key constraints. A good place to start out, when learning about using foreign keys is probably the MySQL manual:
http://dev.mysql.com/doc/mysql/en/In...nstraints.html

You'll find a full description of how to go about building your key constraints. The main thing to watch out for, is to make sure that both the fields (PK in the parent table and FK in the foreign table) are off exactly the same datatype, and that the indexing requirements have been met. MySQL simply won't allow you to create the constraint, otherwise. It's actually a fair bit more rdgid in how it assigns and enforces foreign keys than is the case with simple desktop packages, like Access, since the aim is to preserve the speed of the queries run against the data. Foreign keys are a powerful tool, but they sap speed if they are not designed with care.
Reply With Quote