sql 语句问题,请高手帮忙

[复制链接]
查看11 | 回复3 | 2011-10-25 20:46:28 | 显示全部楼层 |阅读模式
select 学生.学号,姓名 from 学生,选课 选课1 where 学生.学号=选课1.学号 and not exists (select * from 选课 选课2 where 选课2.学号='s001' and not exists (select* from 选课 选课3 where选课2.课程号=选课3.课程号 and 选课1.学号=选课3.学号));我刚作出来的,你自己修改语句中的表名和属性名称吧。...
回复

使用道具 举报

千问 | 2011-10-25 20:46:28 | 显示全部楼层
select s2.*from student s2,sc c2where s2.sno=c2.snoand s2.sno s.snoand c2.cno in(select c.cnofrom student s,sc cwhere s.sno=c.snoand s.sno='s001')...
回复

使用道具 举报

千问 | 2011-10-25 20:46:28 | 显示全部楼层
试试是否可行吧...select a.sno,a.sname fromstudent a inner join sc b on a.sno=b.sno and b.cno in(select cno from sc where sno='s001')...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行