CREATE TABLE `Student` (
`Sno` varchar(20) NOT NULL,
`Sname` varchar(10) DEFAULT NULL,
`Ssex` varchar(2) DEFAULT NULL,
`Sage` int(3) DEFAULT NULL,
`Sdept` varchar(10) DEFAULT NULL,
PRIMARY KEY (`Sno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `Course` (
`Cno` varchar(10) NOT NULL,
`Cname` varchar(20) DEFAULT NULL,
`Cpno` varchar(10) DEFAULT NULL,
`Ccredit` int(3) DEFAULT NULL,
PRIMARY KEY (`Cno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `SC` (
`Sno` varchar(20) NOT NULL,
`Cno` varchar(10) NOT NULL,
`Grade` int(3) DEFAULT NULL,
PRIMARY KEY (`Sno`,`Cno`),
KEY `Cno` (`Cno`),
CONSTRAINT `sc_ibfk_1` FOREIGN KEY (`Sno`) REFERENCES `student` (`Sno`),
CONSTRAINT `sc_ibfk_2` FOREIGN KEY (`Cno`) REFERENCES `course` (`Cno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create view p(Sno,Sname,Ssex,Sage,Sdept)
as
select *
from student
where Sno not in
(select distinct Sno
from sc)