mysql> create table purview ( relo_id int not null, menu_id int not null, str char(20) not null, primary key f_k (relo_id,menu_id) ) engine innodb; Query OK, 0 rows affected (0.00 sec)mysql> create table child (id int not null primary key, relo_id int not null, menu_id int not null, index (relo_id,menu_id), foreign key (relo_id,menu_id) references purview(relo_id,menu_id) ) engine innodb; Query OK, 0 rows affected (0.00 sec)mysql>
mysql> create table purview ( relo_id int not null, menu_id int not null, str char(20) not null, primary key f_k (relo_id,menu_id) ) engine innodb;
Query OK, 0 rows affected (0.00 sec)mysql> create table child (id int not null primary key, relo_id int not null, menu_id int not null, index (relo_id,menu_id), foreign key (relo_id,menu_id) references purview(relo_id,menu_id) ) engine innodb;
Query OK, 0 rows affected (0.00 sec)mysql>