设教学数据库中有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 * from sales where qty between 1000 and 10000(2)select gname,price,type,qty from goods,sales where goods.g#=sales.g# and fact='青岛海尔集团' and s# in(select s# from shops where sname='北京东方大厦') (3)select g# from (select g#,max(a.aqty) from (select g#,AVG(QTY) as aqty from sales group by g#) as a group by g#) as b 本来这题用top 做简单、但是考虑到有销售量相同的、还是用上面这个 (4)delete from sales where qty is null (5)create view S_VIEW as select * from shops where addr like '南京路%'


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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存