mysql建立外键出错,求原因及解决方法 img=http://][/img]我按照图中的scheme建立表,红色方框这个地方的外键约束添加就出错,大神教我怎么解决mysqlscheme外键 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 贴出你的 show create table 语句和错误信息。 我已经解决了,应该是因为在建contact_interest和contact_seeking两表时contact_id的外键约束名一样,create table contact_interest(contact_id int not null,interest_id int not null,primary key(contact_id,interest_id),constraint my_contacts_contact_id_fkforeign key(contact_id)references my_contacts(contact_id),constraint interests_interest_id_fkforeign key(interest_id)references interests(interest_id));create table contact_seeking(contact_id int not null,seeking_id int not null,primary key(contact_id,seeking_id),constraint my_contacts_contact_id_fkforeign key(contact_id)references my_contacts(contact_id),constraint seeking_seeking_id_fkforeign key(seeking_id)references seeking(seeking_id));这是错误原因吧!我的建表语句还有没有其他问题? 小问题mysql count()函数 天,突然发现MySQL的一个新特征!这是真的吗? 两个单引号 cursor is closed mysql 怎样的操作算是sequential io或是 random io? mysql触发器触发后,如何通知程序呢? MySql导出后,再导入数据时出错问题 初次使用MySQL,c api简单问题,立刻给分 高分求助!! 怎样在ODBC里创建Postgressql的数据源? 实在搞不定了,MYSQL 5.6 一个数据库中文乱码 select语句问题, 怎样将两个表内相同的列生成一个表内? ubuntu下启动mysql
(
contact_id int not null,
interest_id int not null,
primary key(contact_id,interest_id),
constraint my_contacts_contact_id_fk
foreign key(contact_id)
references my_contacts(contact_id),
constraint interests_interest_id_fk
foreign key(interest_id)
references interests(interest_id)
);create table contact_seeking
(
contact_id int not null,
seeking_id int not null,
primary key(contact_id,seeking_id),
constraint my_contacts_contact_id_fk
foreign key(contact_id)
references my_contacts(contact_id),
constraint seeking_seeking_id_fk
foreign key(seeking_id)
references seeking(seeking_id)
);
这是错误原因吧!我的建表语句还有没有其他问题?