You are here: Compound and Foreign Keys in MySQL « PHP SQL « IT news, forums, messages
Compound and Foreign Keys in MySQL

Posted by thehuby on 10/07/05 15:44

Can anyone help me define the syntax for creating compound keys in
mysql?

I want to have a pair of foreign keys as a compound primary key in a
table.

Also - can anyone tell me if MySQL supports foreign key constraints
correctly? I have written the SQL for them and even added it to the
database successfully, but it doesn't seem to stop me adding whatever
values I want to into the fields. Someone mentioned innoDB or
something but I am not sure what it is.

MySQL syntax for the table in question is below:

CREATE TABLE authorisation_config (
fk_user_id INT(3) NOT NULL, /* FK user */
fk_website_section_id INT(3) NOT NULL, /* FK website_section */
auth_type ENUM ("contributor", "approver", "contributor/approver" )
NOT NULL DEFAULT 1
);

Regards,

Rick

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация