我的查詢是:(查找,要麼在115房間裏開會或者有五個以上的學生就讀的所有類的名稱。)我想寫在mysql的這個查詢,你會幫我
CREATE TABLE STUDENT (
sid NUMERIC(6) NOT NULL,
sname VARCHAR(15),
major VARCHAR(20),
level VARCHAR(2),
sage NUMERIC(2) NOT NULL,
PRIMARY KEY (sid)
);
CREATE TABLE CLASS(
cnum VARCHAR(6),
meets_at TIME,
room VARCHAR(6),
fid NUMERIC(6) ,
PRIMARY KEY (cnum),
FOREIGN KEY (fid)
references FACULTY (fid)
);
CREATE TABLE ENROLLED (
cnum VARCHAR(6),
sid NUMERIC(6) NOT NULL,
PRIMARY KEY (cnum,sid),
FOREIGN KEY (sid)
REFERENCES STUDENT (sid),
FOREIGN KEY (sid)
REFERENCES FACULTY (fid),
FOREIGN KEY (cnum)
REFERENCES CLASS (cnum)
);
alter table ENROLLED
add foreign key (sid)
references STUDENT (sid);
您是否嘗試過自己嗎?你嘗試了什麼? – Jon 2012-04-17 07:13:22
...你的作業? – 2012-04-17 07:14:58