山東大學軟體學院2017-18學年資料庫實驗五、六、七、八
注:所有實驗均為自己思考所答,非轉載抄襲,並全部通過實驗系統檢測。希望學弟學妹自主思考,答案不唯一可能有些效率不高,僅供參考。
-
實驗五
實驗步驟:(不要求羅列完整原始碼) create table test5_00 as select * from pub.TEACHER grant all on test5_00 to user201600301315 update test5_00 set age = 88 select * from test5_00 Commit Rollback update test5_00 set age = age + 1 Rollback Commit update test5_00 set age = age + 2 Commit select * from test5_00 Rollback select * from userb201600301315.test5_00 update test5_00 set age = age - 2 update test5_00 set age = age - 2 select * from test5_00 select * from userb201600301315.test5_00 Commit select * from userb201600301315.test5_00 Rollback update userb201600301315.test5_00 set age = age – 10 Select * from test5_00 create table test5_01 as select * from test5_00 Rollback select * from userb201600301315.test5_00 select * from userb201600301315.test5_00 Rollback select * from userb201600301315.test5_00
結果為:88 90 90 86 90 90 86 86 76 86 |
-
實驗六
實驗步驟:(不要求羅列完整原始碼)
create view test6_01 as select sid,name,dname from pub.STUDENT where age<20 and dname='物理學院' order by sid
create view test6_02 as select pub.STUDENT.SID sid,pub.STUDENT.NAME name,sum(score) sum_score from pub.STUDENT,pub.STUDENT_COURSE where pub.STUDENT.SID=pub.STUDENT_COURSE.SID and pub.STUDENT.CLASS=2009 and pub.STUDENT.DNAME='軟體學院' group by pub.STUDENT.SID,pub.STUDENT.NAME
create view test6_03 as select pub.STUDENT.SID sid,pub.STUDENT.NAME name,pub.STUDENT_COURSE.SCORE score from pub.STUDENT,pub.STUDENT_COURSE,pub.COURSE where pub.STUDENT_COURSE.CID=pub.COURSE.CID and pub.STUDENT.SID=pub.STUDENT_COURSE.SID and pub.STUDENT.CLASS=2010 and pub.STUDENT.DNAME='電腦科學與技術學院' and pub.COURSE.NAME = '作業系統'
create view test6_04 as select pub.STUDENT.SID sid,pub.STUDENT.NAME name from pub.STUDENT,pub.STUDENT_COURSE,pub.COURSE where pub.STUDENT_COURSE.CID=pub.COURSE.CID and pub.STUDENT.SID=pub.STUDENT_COURSE.SID and pub.COURSE.NAME = '資料庫系統' and pub.STUDENT_COURSE.SCORE>90
create view test6_05 as select pub.STUDENT.SID sid,pub.STUDENT_COURSE.CID cid,pub.COURSE.NAME,pub.STUDENT_COURSE.SCORE from pub.STUDENT,pub.STUDENT_COURSE,pub.COURSE where pub.STUDENT_COURSE.CID=pub.COURSE.CID and pub.STUDENT.SID=pub.STUDENT_COURSE.SID and pub.STUDENT.NAME='李龍'
create or replace view test6_06 as select a.SID,a.NAME from pub.STUDENT a where not exists ((select cid from pub.COURSE) minus (select cid from pub.STUDENT natural join pub.STUDENT_COURSE where a.sid = sid))
create or replace view test6_07 as select a.SID,a.NAME from pub.STUDENT a where not exists( (select cid from pub.COURSE) minus (select cid from pub.STUDENT natural join pub.STUDENT_COURSE where a.sid = sid and score>=60))
create or replace view test6_08 as select A.cid, A.NAME from pub.COURSE A, pub.COURSE B where A.FCID = B.CID and B.CREDIT = 2
注:學分為成績大於等於60才算
create or replace view test6_09 as select pub.STUDENT.SID sid,pub.STUDENT.NAME name,sum(credit) sum_credit from pub.STUDENT,pub.STUDENT_COURSE,pub.COURSE where pub.STUDENT.SID=pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID=pub.COURSE.CID and pub.STUDENT.CLASS=2010 and pub.STUDENT.DNAME='化學與化工學院' and pub.STUDENT_COURSE.SCORE>=60 group by pub.STUDENT.SID,pub.STUDENT.NAME
create or replace view test6_10 as select A.CID,A.NAME from pub.COURSE A,pub.COURSE B,pub.COURSE C where A.FCID = B.CID and B.FCID = C.CID
|
-
實驗七
實驗步驟:(不要求羅列完整原始碼)
create table test7_01 as select First_name, (count(*)) frequency from (select (substr(name,2)) First_name from pub.STUDENT) group by First_name
2.統計名字每個字的使用頻率
create table test7_02 as select letter,(count(*)) frequency from ((select (substr(name,2,1)) letter from pub.STUDENT) union all (select (substr(name,3,1)) letter from pub.STUDENT where substr(name,3,1) is not NULL)) group by letter
3.統計學院班級學分達標情況統計表1
create table test7_03 as select * from (select dname, class, (count(*)) P_count1 from (select S.sid, S.DNAME, S.CLASS, sum_credit from pub.STUDENT S, (select sid, (sum(credit)) sum_credit from pub.STUDENT_COURSE SC, pub.COURSE C where SC.CID = C.CID and SC.SCORE >= 60 and dname is not NULL group by sid) B where S.SID = B.SID) where sum_credit > = 10 and dname is not NULL group by dname, class)
natural full outer join
(select dname, class, (count(*)) P_count2 from (select S.sid, S.DNAME, S.CLASS, sum_credit from pub.STUDENT S, (select sid, (sum(credit)) sum_credit from pub.STUDENT_COURSE SC, pub.COURSE C where SC.CID = C.CID and SC.SCORE >= 60 and dname is not NULL group by sid) B where S.SID = B.SID) where sum_credit < 10 and dname is not NULL group by dname, class)
natural full outer join
(select * from (select dname, class, (count(*)) P_count from pub.STUDENT where dname is not NULL group by dname, class) sum_count)
4.統計學院班級學分達標情況統計表2
create table test7_04 as select * from (select dname, class, (count(*)) P_count1 from (select A.sid, A.DNAME, A.CLASS, sum_credit from pub.STUDENT A, (select sid, (sum(credit)) sum_credit from pub.STUDENT_COURSE S, pub.COURSE K where S.CID = K.CID and S.SCORE >= 60 group by sid) B where A.SID = B.SID and A.DNAME is not NULL) where (sum_credit > = 10) or (sum_credit > = 8 and class <= 2008) group by dname, class) natural full outer join (select dname, class, (count(*)) P_count2 from (select A.sid, A.DNAME, A.CLASS, sum_credit from pub.STUDENT A, (select sid, (sum(credit)) sum_credit from pub.STUDENT_COURSE S, pub.COURSE K where S.CID = K.CID and S.SCORE >= 60 group by sid) B where A.SID = B.SID) where sum_credit < 10 and dname is not NULL group by dname, class) natural full outer join (select * from (select dname, class, (count(*)) P_count from pub.STUDENT where dname is not NULL group by dname, class) sum_count) |
-
實驗八
實驗步驟:(不要求羅列完整原始碼)
create table test8_01 as select * from (select dname, (round(avg(s1),0)) Avg_ds_score from (select pub.STUDENT.SID, max(score) s1 from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '資料結構' group by pub.STUDENT.SID) A, pub.STUDENT B where A.SID = B.SID and dname is not NULL group by dname)
natural full outer join
(select dname, (round(avg(s2),0)) Avg_os_score from (select pub.STUDENT.SID, max(score) s2 from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '作業系統' group by pub.STUDENT.SID) A, pub.STUDENT B where A.SID = B.SID and dname is not NULL group by dname)
create table test8_02 as select A.SID, name, dname, ds_score, os_score from (select pub.STUDENT.SID, max(score) ds_score from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '資料結構' group by pub.STUDENT.SID) A,
(select pub.STUDENT.SID, max(score) os_score from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '作業系統' group by pub.STUDENT.SID) B,
pub.STUDENT C
where A.SID = B.SID and B.SID = C.SID and dname = '電腦科學與技術學院'
create table test8_03 as select sid, name, dname, ds_score, os_score from (select * from (select pub.STUDENT.SID, max(score) ds_score from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '資料結構' group by pub.STUDENT.SID)
natural full outer join
(select pub.STUDENT.SID, max(score) os_score from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '作業系統' group by pub.STUDENT.SID) )
natural join pub.STUDENT where dname = '電腦科學與技術學院'
create table test8_04 as select sid, name, dname, ds_score, os_score from (select * from (select pub.STUDENT.SID, max(score) ds_score from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '資料結構' group by pub.STUDENT.SID)
natural full outer join
(select pub.STUDENT.SID, max(score) os_score from pub.STUDENT, pub.STUDENT_COURSE, pub.COURSE where pub.STUDENT.SID = pub.STUDENT_COURSE.SID and pub.STUDENT_COURSE.CID = pub.COURSE.CID and pub.COURSE.NAME = '作業系統' group by pub.STUDENT.SID) ) natural right outer join pub.STUDENT where dname = '電腦科學與技術學院'
|
相關文章
- 山東大學軟體學院2017-18學年大二資料結構實驗一、二、三、四資料結構
- 華中科技大學軟體學院機器學習課程實驗機器學習
- 湖南大學 實驗八 招聘
- 系統學習大資料需要學習哪些內容,五年大資料工程師經驗分享大資料工程師
- 【招聘】NLP文字挖掘研究員-深圳大學傳播學院大資料傳播實驗室大資料
- 山東大學軟體工程數字影像處理2018考試回憶版軟體工程
- 2021年春季學期 計算機學院《軟體構造》課程 Lab 1實驗報告計算機
- Redis學習筆記(七) 資料庫Redis筆記資料庫
- 山東科技大學OJ題庫 1403 它滿足條件嗎?
- InnoDB學習(六)之資料庫鎖資料庫
- 大資料如何學習,大資料工程師學習經驗分享大資料工程師
- 百度前端學院-基礎學院-第七天到第八天前端
- 大資料學習|小白學習大資料需要滿足這六個條件你就能學好大資料大資料
- 資料庫實驗八 資料庫程式設計資料庫程式設計
- 資料庫學習(五)子查詢資料庫
- 學習資料科學的五大免費資源資料科學
- 山東科技大學OJ題庫 1009-簡單的打折計算
- 山東藝術學院“玫瑰少年”某安全組織發聲事件!事件
- 大學物理實驗電學基本引數的測量實驗報告_大學物理電學實驗報告
- 資料庫大賽50強之「華東師範大學」:恰同學少年,程式碼激揚!資料庫
- 山東大學專案實訓-基於LLM的中文法律文書生成系統(八)- 前端(一) - gradio前端
- 優思學院|如何領導六西格瑪變革?學習哈佛商學院的八步變革模型模型
- 山東大學專案實訓-基於LLM的中文法律文書生成系統(五)- ChatGLM(2)
- Java軟體開發者,如何學習大資料?Java大資料
- 暑期自學 Day 14 | 資料庫 (七)- 事務資料庫
- 優思學院|揭秘六西格瑪:七大迷思你不可不知!
- 使用 .NET 5 體驗大資料和機器學習大資料機器學習
- 資料庫實驗五:資料庫程式設計資料庫程式設計
- 想學習大資料?這才是完整的大資料學習體系大資料
- 暑期自學 Day 12 | 資料庫 (五)- 多表,資料庫設計資料庫
- 資料庫學習(六)聯合查詢union資料庫
- 【公益譯文】卡內基梅隆大學軟體工程學院:勒索軟體威脅現狀(三)軟體工程
- 【公益譯文】卡內基梅隆大學軟體工程學院:勒索軟體威脅現狀(四)軟體工程
- 【公益譯文】卡內基梅隆大學軟體工程學院:勒索軟體威脅現狀(一)軟體工程
- 飛機的 PHP 學習筆記八:資料庫PHP筆記資料庫
- MYSQL學習與實驗(八)——儲存過程實驗MySql儲存過程
- 大學物理實驗電學基本引數的測量實驗報告_大學物理實驗報告(清華大學)實驗3.1電學元件伏安特性的測量實驗報告.doc...元件
- 2021 年最佳資料科學工具和軟體 - datamation資料科學