最新回答 / tinylight
在这一章节中,我们只用到了create和update这两种生成策略,create会自动建表,update不仅可以自动建表,还可以对表进行更新操作
2016-10-22
CREATE TABLE class
(
cid INT PRIMARY KEY,
cname VARCHAR(20) NOT NULL,
cremarks VARCHAR(20)
);
CREATE TABLE student
(
sid INT PRIMARY KEY,
sname VARCHAR(20) NOT NULL,
sremarks VARCHAR(20),
cid INT
);
ALTER TABLE student ADD FOREIGN KEY fk_student_cid (cid) REFERENCES class(cid);
(
cid INT PRIMARY KEY,
cname VARCHAR(20) NOT NULL,
cremarks VARCHAR(20)
);
CREATE TABLE student
(
sid INT PRIMARY KEY,
sname VARCHAR(20) NOT NULL,
sremarks VARCHAR(20),
cid INT
);
ALTER TABLE student ADD FOREIGN KEY fk_student_cid (cid) REFERENCES class(cid);
2016-10-14