【数据库原理】闯关作业答案

Valora ·
更新时间:2024-11-11
· 872 次阅读

实验二 四个关卡

第一关:

insert into Student (sno, sname, ssex, sage, sdept) values ('001','Smith','m',18,'CS'); insert into Student (sno, sname, ssex, sage, sdept) values ('002','Ketty','f',19,'MA'); insert into Course (cno,cname,cpno,ccredit) values ('C01','DB',null,2); insert into Course (cno,cname,cpno,ccredit) values ('C02','Oracle','C01',3); insert into SC (sno,cno,grade) values ('001','C01',70); insert into SC (sno,cno,grade) values ('001','C02',82); insert into SC (sno,cno,grade) values ('002','C01',86);

第二关

update SC set grade=grade+5 where grade<60; update Student set Sage=Sage+1 where Ssex='m' and Sdept='CS'; update Student set Sno='S'+Sno where Sno!='';

第三关

update Student set Sno = REPLACE(Sno, 'S', ''); update Student set Sno=RTRIM(Sno)+'S';

第四关

delete from SC where grade is null; delete from Student where Ssex='f'and Sage = '18' delete from course where ccredit=3;
作者:HYQ2419341043



数据 数据库原理 数据库

需要 登录 后方可回复, 如果你还没有账号请 注册新账号