2 liu19932870 liu19932870 于 2017.09.05 10:24 提问

1215 Cannot add foreign key constraint

CREATE DATABASE java1707;
USE java1707;
CREATE TABLE tab(
tab_id VARCHAR(10),
location VARCHAR(50));
CREATE TABLE student(
stu_id VARCHAR(10)PRIMARY KEY,
stu_name VARCHAR(10),
tab_id VARCHAR(10),
age INT
);
ALTER TABLE student ADD FOREIGN KEY(tab_id) REFERENCES tab(tab_id);

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.05 11:07
Csdn user default icon
上传中...
上传图片
插入图片