试用SQL语句描述对数据库student中3个基本表中s、c、sc的 *** 作

试用SQL语句描述对数据库student中3个基本表中s、c、sc的 *** 作,第1张

1.insert into student(sno,sname,sex) select s.sno,s.sname,s.sex from sc sc left join s s on s.sno=sc.snoleft join c c on sc.cno=c.cno where sc.grade>=80 and sc.cno='第一门课程'2.delete from sc where grade=0 or grade is null3.delete from sc where sno='0001'4.update sc set grade=0 where sno in (select sc.sno from sc sc left join c c on sc.cno=c.cnowhere c.cname='数据库应用' and sc.grade<60)5.update sc set grade=grade*1.05

where sno in(

select sc.sno

from sc sc

left join s s

on sc.sno=s.sno

where grade<(select avg(grade) from sc)

and s.ssex='f'

)

6.update sc set grade=grade*1.04

where grade>75 and cno='c001'

update sc set grade=grade*1.05

where grade<=75 and cno='c001'

SC表是S表的子表。SQL语句创建sc表,数据库sc表的意思SC表是S表的子表,共同组成了一个候选码,因为他们的任何一个子集都不能唯一确定表中的一列,数据库是按照数据结构来组织、存储和管理数据的建立在计算机存储设备上的仓库。


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

原文地址:https://54852.com/sjk/9753957.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存