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