Is it possible to have a composite key in mysql(5.1) and if so, what is the syntax?
table a:
column aa,bb
references table b
columns b_aa,b_bb
Is it possible to have a composite key in mysql(5.1) and if so, what is the syntax?
table a:
column aa,bb
references table b
columns b_aa,b_bb
With InnoDB tables, you can, like:
create table YourTable (
col1 int,
col2 int,
constraint foreign key (col1, col2)
references OtherTable (col1, col2)
on delete cascade
) type=InnoDB;
For MyISAM
tables, foreign key constraint are silently ignored.
for complete tutorial: http://dev.mysql.com/doc/refman/4.1/en/innodb-foreign-key-constraints.html