第1个回答 2010-01-16
1、select cno,cname from c where tname='张三';
2、select sno,sname from s where class='信息502班'
and sex='男';
3、select c.cname,c.tname from c where cno in ( select cno from sc where sno='1003');
4、select sname
from s
where sex='女'
and sno in
(select sno
from sc
where cno in
( select cno
from c
where tname='张三'
)
);
5、select cno
from c
where cno not in
( select cno
from sc
where sno in
(select sno
from s
where sname='王五'
)
);
6、select sno
from sc
where cno in ('c001','c002')
group by sno
having count(*)>1;
7、select cno from sc group by cno having count(*) in (select count(*) from s);
【不确定用 ‘=’ 是否正确,所以用 ‘in’,你可以自己试试‘=’!!】
8、select sno from sc where not exists (sc.cno not in (select cno from c where t.name='张三'));
【也就是不存在(课程不是张三讲授)的学生学号】
第2个回答 2010-01-14
1,select cno,cname from c where tname='张三'
2,select sno,sname from s where class='502'
and sex='男'
3,select c.cname,c.tname from c ,sc where c.cno=sc.cno and sc.sno='1003'
4, select distinct s.sname from s inner join sc on sc.sno=s.sno inner join c on sc.cno=c.cno where s.sex='女' and c.tname='张三'
5,select cno from c where cno not in( select sc.cno from s,sc where s.sno=sc.sno and s.name='王五' )
6,select sno from sc where cno in ('c001','c002')
7,select cno from sc where sno in (select sno from s)
8,select sno from sc where cno in (select cno from c where t.name='张三')本回答被提问者和网友采纳