添加外键失败,大家帮忙看一下哪里出错了?
CREATE TABLE student(
sid INT PRIMARY KEY,
sname VARCHAR(20) NOT NULL,
sex CHAR(2),CONSTRAINT fk_stu_gid FOREIGN KEY(gid)
REFERENCES grade(gid);)
CREATE TABLE student(
sid INT PRIMARY KEY,
sname VARCHAR(20) NOT NULL,
sex CHAR(2),
gid INT
ALTER TABLE student ADD
CONSTRAINT fk_stu_gid FOREIGN KEY(gid)
REFERENCES grade(gid);