日期:2014-05-17 浏览次数:20473 次
CREATE TABLE S(
SNO VARCHAR(10) PRIMARY KEY,
SNAME VARCHAR(20) NOT NULL
);
CREATE TABLE C(
CNO VARCHAR(10) PRIMARY KEY,
CNAME VARCHAR(10) NOT NULL,
CTEACHER VARCHAR(5) NOT NULL
);
CREATE TABLE SC(
SNO VARCHAR(10) NOT NULL,
CNO VARCHAR(10) NOT NULL,
SCGRADE VARCHAR(3) NOT NULL
);
SELECT SNAME FROM S WHERE NOT EXISTS(
SELECT * FROM C,SC WHERE C.CNO=SC.CNO AND S.SNO=SC.SNO
AND C.CTEACHER='李兴华'
);
--MSSQL
SELECT SNAME FROM S
JOIN SC ON SC.SNO=S.SNO
JOIN C ON SC.CNO=C.CNO
WHERE C.CTEACHER='李兴华'