Foreign keys / Transactions in MySQL.. WTF?

Nic Gibson nicg at
Tue Jul 31 08:53:33 BST 2007

On 31/07/07, Jamie Nicholson <jamie.nicholson at> wrote:
> >I need to confirm this in the manuals, but it seems to me that MySQL 4.1has
> >no support for foreign keys. If you're looking for a Relational Database
> >Management System, look another way ;-)
> This article gives an explanation of MYSQL foreign keys, might help.
> Cheers,
> Jamie

>From said article (and yes, I'm also primarily a PostgreSQL person):

> In order to create a foreign key, you need the following:
>Both tables need to be InnoDB tables.

> To use the syntax FOREIGN KEY(fk_fieldname) REFERENCES table_name
> (fieldname)

Single field keys only? Or is that just the article?

> The field being declared a foreign key needs to be declared as an index in the
>  table definition

Does this mean that keys and indices are the same thing in MySQL or is
it just the phrasing?

Nic Gibson
Director, Corbas Consulting Ltd
Editorial and Technical Consultancy

More information about the mailing list