日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

数据库笔试题

發布時間:2023/12/20 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数据库笔试题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

筆試題一

? ? ? ? 1:已知關系模式:

? ? ? ? ? ? ?S(SNO, SNAME)學生關系,SNO為學號,SNAME為姓名;

? ? ? ? ? ? ?C(CNO, CNAME, CTEACHER)課程關系,CNO為課程號,CNAME為課程名,CTEACHER為任課教師

? ? ? ? ? ? ?SC(SNO, CNO, SCGRADE)選課關系,SCGRADE為成績

? ? ? ? ?a:書寫SQL,找出沒有選修過‘李明’老師講授課程的所有學生姓名:

方法一:

select sname from s where sno in (select distinct sno from c, sc where c.cno = sc.cno and cteacher != '李明' and sc.sno = s.sno );方法二: select sname from s where not exists(select * from sc, c where sc.cno = c.cno and c.cteacher = '李明' and sc.sno = s.sno )

? ? ? ? ?b:書寫SQL,列出有兩門以上(含兩門)不及格課程的學生姓名及其平均成績:

select s.sname, avg_scgrade(sc.scgrade) from s, sc (select sno from sc where scgrade < 60 order by sno having count(distince cno) >= 2) a where s.sno = a.sno and sc.sno = a.sno group by s.sname;

? ? ? ? ?c:書寫SQL,列出既學過‘1’號課程,又學過‘2’號課程的所有學生姓名:

select s.sname from s, (select sc.sno from sc, c where sc.cno and c.cno and c.cname in ('1', '2') group by sno having count(distinct cno) = 2 ) sc where s.sno = sc.sno;

? ? ? ? ?d:書寫SQL,列出‘1’號課程成績比‘2’號同學該門課成績高的所有學生的學號:

select s.sname from s, sc sc1, sc sc2 where sc1.sno = '1' and sc2.sno = '2' and sc1.cno = s.cno and sc1.scgrade > sc2.scgrade

? ? ? ? ?e:列出‘1’號課成績比‘2’號課成績高的所有學生的學號及其‘1’號課和‘2’號課的成績:

select sc1.sno, sc1.scgrade 1號課成績, sc2.scgrade 2號課成績 from sc sc1, sc sc2where sc1.cno = '1' and sc2.cno = '2' and sc1.sno = sc2.sno and sc1.scgrade > sc2.scgrade




總結

以上是生活随笔為你收集整理的数据库笔试题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。