select * from s where sid not in(select sid from cs where cid in(select cid from c where cname like '%java%'))
解题思路,查找出学生信息,让他的sid不出现在已经选了此课程的学生中。
建议做字符的匹配时使用like
select SNAME from S where SID not in (select SID from CS,C
where CS.CID=C.CID and C.CNAME='JAVA')