版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第4章答案4-1selectcorId,corNamefromcourses;4-2select*fromsc;4-3selectcorName,period*1.1fromcourses;4-4selectcorId,corName,round(period,0)fromcourses;4-5selectstuId,stuName,year(curdate())-year(birth)asagefromstudents;4-6selectdistinctcreditfromcourses;4-7select*fromstudentswheresex='男';4-8select*fromcourseswhereperiod<='40';4-9select*fromstudentswherebirth>='2003-1-1'andbirth<='2003-12-31';4-10select*fromstudentswherestuNamein('劉晨','王小敏','趙麗');4-11select*fromcourseswherecorNamelike'數(shù)據(jù)庫';4-12select*fromcourseswherecorNamelike'____';4-13select*fromstudentswheretelNonotlike'22%';4-14select*fromstudentswherecommentisnull;4-15select*fromscwherecorId='001'andscore<='60';4-16select*fromstudentswherestuNamelike'張%'orstuNamelike'王%';4-17select*fromcoursesorderbycorld,corName,credit;4-18select*fromscwherestuId='210101001'orderbycorId,scoredesc;4-19select*fromcourseslimit3;4-20select*fromcoursesLIMIT5,4;4-21select*fromscwherestuId='210101001'LIMIT5;4-22selectCOUNT(corName)as總課程數(shù)fromcourses;4-23selectMAX(period)as最長時(shí)長,MIN(credit)as最低時(shí)長fromcourses;4-24selectSUM(score)as總成績(jī),AVG(score)as平均成績(jī)fromscwherestuId='210101003';4-25selectclass,COUNT(*)AS人數(shù)fromstudentsgroupbyclass;4-26selectstuId,count(corId)as選課人數(shù)fromscgroupbycorId;4-27selectclass,count(stuId)as學(xué)生人數(shù)fromstudentsgroupbyclass;havingcount(stuId)<35;4-28selectcorId,count(stuId)as選課人數(shù)fromscgroupbycorIdhavingcount(stuId)<5;4-32selectcourses.*,sc.*fromcoursesinnerjoinsconcourses.corId=sc.corId;4-33selectstudents.stuId,stuName,score,strDatefromstudentsinnerjoinsconstudents.stuId=sc.stuIdwherestudents.stuId='210101001';4-34selectstudents.stuId,stuName,courses.corId,corName,scorefrom(studentsinnerjoinsconstudents.stuId=sc.stuId)innerjoincoursesoncourses.corId=sc.corIdwherescore<60;4-35selectstuName,corId,scorefromstudentsinnerjoinsconstudents.stuId=sc.stuIdwherestuName='張永立'andscore>=80;4-36selectstudents.stuId,stuName,avg(score)fromstudentsinnerjoinsconstudents.stuId=sc.stuIdgroupbystudents.stuId;4-37selectclass,corName,count(sc.stuId)as學(xué)生人數(shù)from(studentsinnerjoinsconstudents.stuId=sc.stuId)innerjoincoursesoncourses.corId=sc.corIdwherecorName='數(shù)據(jù)庫'groupbyclass;4-38selectcourses.corId,corNamefromcoursesLEFTJOINsconcourses.corId=sc.corIdwheresc.corIdisnull;4-39selectstuId,score,strDatefromscwherecorIdin(selectcorId fromcourses wherecorName='操作系統(tǒng)');4-40select*fromcourseswherecredit>(selectcredit fromcourses wherecorName='操作系統(tǒng)');4-41SELECT*FROMstudentsWHEREbirth>All(SELECTbirth FROMstudents WHEREclass='計(jì)算機(jī)應(yīng)用');4-42SELECT*FROMstudentsWHEREbirth>ANY(SELECTbirth FROMstudents WHEREclass='計(jì)算機(jī)應(yīng)用');4-43select*fromscwherenotexists(select*fromcourses wheresc.corId=courses.couId);4-44select*fromcourseswhereperiod>‘54’unionselect*fromcourseswherecredit<’3’;4-45selectcorIdfromcourseswhereperiod>54unionselectdistinctcorIdfromsc;第5章答案5-1INSERTintostudentsVALUES('220102035','張小燕','電子商務(wù)','女','2003-12-25','22319874','zhangxiaoyan@163.com','null');5-2INSERTINTOsc(stuId,corId,score,strdate)VALUE('220102035','85','2022-9-2'),('220102035','002','70','2022-9-2'),('220102035','003','93','2022-9-1');5-3CREATETABLEscoreavg(stuidchar(3),avgscoreINT)INSERTINTOscoreavgSELECTstuId,avg(score)fromsccgupbystuId;5-4updatecoursessetperiod=36wherecorName='操作系統(tǒng)';5-5updatescsetscore=0wherestuIdin(selectstuIdfromstudents whereclass='計(jì)算機(jī)應(yīng)用');5-6deletefromcourseswherecorName='操作系統(tǒng)'5-7deletefromscwherecorIdin(selectstuNamefromsc wherecorName='計(jì)算機(jī)應(yīng)用')第6章答案6-1CREATEVIEWcourses1ASSELECT*FROMcoursesWHEREperiod>'54';6-2CREATEVIEWcourses2ASSELECT*FROMcoursesWHEREperiod>'54'WITHCHECKOPTIONS;6-3createviewfemale001(stuId,stUName,corId,score)asselectstudents.stuId,stuName,corId,scorefromstudentsinnerjoinsconstudnets.stuId=sc.stuIdwherecorId=‘001'andsex='女';6-4createviewfemale00180asselectstuId,stuName,corId,scorefromfemale001wherescore>'80';6-5creatviewstuavgscore(corId,avg)asselectcorId,round(avg(score),1)fromscgroupbycorId;6-6selectperiod,creditfromcourselwherecorName='數(shù)據(jù)庫';6-7select*fromfemaie001wherescore>='60';6-8inereintocourses1values('065','大數(shù)據(jù)可視化技術(shù)','54','3');6-9updatecourselsetperiod=54wherecorName='數(shù)據(jù)庫';6-10deletefromcourse1wherecorName='數(shù)據(jù)庫';6-11dropviewcourse1;6-12createprocedureStuproc5(var_corNamevarchar(30))beginselectcorName,period,creditfromcourseswherecorName=var_corName;End6-13createprocedureStuproc6(var_corNamevarchar(30))beginselectstuId,scorefromcoursesinnerjoinsconcourses.corId=sc.corIdwherecorName=var_corName;EndcallStuproc6('數(shù)據(jù)庫')6-14createprocedureStuproc7(invar_corIdchar(3),outvar_countint)beginselectcount(*)intovar_countfromscwherecorName=var_corId;End6-16dropprocedureStuproc5;6-17createtabledelcourses(corIdchar(9)primarykey,corNamevarchar(30));createtriggerdel_cor
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年大學(xué)(工程造價(jià))工程管理模擬真題及解析
- 2025年大學(xué)大二(文物與博物館學(xué))文物學(xué)概論試題及答案
- 2026年職業(yè)知識(shí)(知識(shí)考核)考題及答案
- 2026年注冊(cè)公用設(shè)備工程師(動(dòng)力基礎(chǔ)考試上)試題及答案
- 2025年大學(xué)第三學(xué)年(高分子材料與工程)高分子合成技術(shù)階段測(cè)試試題及答案
- 火電廠熱工自動(dòng)化
- 深度解析(2026)《GBT 18286-2000信息技術(shù) 文本通信用控制功能》(2026年)深度解析
- 深度解析(2026)《GBT 18017.2-1999訂艙確認(rèn)報(bào)文 第2部分訂艙確認(rèn)報(bào)文子集 訂艙確認(rèn)報(bào)文》
- 深度解析(2026)《GBT 17848-1999犧牲陽極電化學(xué)性能試驗(yàn)方法》
- 深度解析(2026)《GBT 17706-1999銷售預(yù)測(cè)報(bào)文》
- d照駕駛證理論考試試題及答案
- GA 68-2024警用防刺服
- 炭窯口硫鐵礦礦山地質(zhì)環(huán)境保護(hù)與土地復(fù)墾方案
- 2025年西點(diǎn)烘焙師職業(yè)考試試卷及答案
- 六西格瑪黑帶培訓(xùn)大綱
- 2025年公安信息管理學(xué)及從業(yè)資格技能知識(shí)考試題與答案
- 興業(yè)銀行貸款合同模板大全
- 普通高等學(xué)校三全育人綜合改革試點(diǎn)建設(shè)標(biāo)準(zhǔn)試行
- 賣房承諾書范文
- 招投標(biāo)自查自糾報(bào)告
- 高校公寓管理述職報(bào)告
評(píng)論
0/150
提交評(píng)論