Foreign keys / Transactions in MySQL.. WTF?

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


On 31/07/07, Jamie Nicholson <jamie.nicholson at gmail.com> 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.
>
> http://www.databasejournal.com/features/mysql/article.php/2248101
>
> 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.
>
OK

> 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
-- 
Nic Gibson
Director, Corbas Consulting Ltd
Editorial and Technical Consultancy
http://www.corbas.co.uk/


More information about the london.pm mailing list