设教学数据库中有3个关系?

设教学数据库中有3个关系?,第1张

select TNO,TN from T where TN like  '_伟%'

select TN from T where TNO='C5'

select T.TNO,T.TN,TC.CNO from T,TC where T.TNO=TC.TNO and T.TN='刘伟'

select TC.TNO,group by TC.CNO as ‘任课数’from TC,T where TC.TNO=T.TNO

and T.Dept='计算机' and  T.TNO in (select TNO from TC group by CNO havingcount(*)>2)

selcet TNO,TN from T where Prof  in (select Prof from T where TN='刘伟')

select x.TN as姓名,x.Sal as 教师工资, y.Sal as刘伟的工资from T as x,T as y

where x.Sal>y.Sal and y.TN='刘伟'

第四问不太确定

1、select s.sno,s.sname,sc.grade

from c join sc on c.cno=sc.cno

join s on s.sno=sc.sno

where c.cno='c2'

2、

select distinct s.sno,s.sname

from c join sc on c.cno=sc.cno and c.cno=‘c2’

join s on s.sno=sc.sno

3、

select s.sno,s.sname

from c join sc on c.cno=sc.cno

join s on s.sno=sc.sno

where c.cname='Maths'

4、

select s.sno,s.sname

from c join sc on c.cno=sc.cno

join s on s.sno=sc.sno

where c.cno in('c2','c4')

5、

select s.sname,s.sage

from c join sc on c.cno=sc.cno

join s on s.sno=sc.sno

where c.cno<>'c2'


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9985048.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-04
下一篇 2023-05-04

发表评论

登录后才能评论

评论列表(0条)

保存