版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
數(shù)據(jù)庫原理答案西安電子科技大學(xué)精品文檔數(shù)據(jù)庫原理-西安電子科技大學(xué)出版社姓名:陳俊昌班級:10923337杭州電子科技大學(xué)計(jì)算機(jī)學(xué)院111)給學(xué)生表增加一屬性 Nation(民族),數(shù)據(jù)類型為varchar(20)altertableStudentaddnationvarchar(20)2)刪除學(xué)生表中新增的屬性 nationaltertableStudentdropcolumnnation3)向成績表中插入記錄(“2001110”,3“”,80)insertintoGrade(Sno,Cno,Gmark)values('2001110','3',80)4)將學(xué)號為“2001110”的學(xué)生成績修改為70分updateGradesetGmark=70whereSno='2001110'5)刪除學(xué)號為“2001110”的學(xué)生成績記錄deletefromGradewhereSno='2001110'6)在學(xué)生表的clno屬性上創(chuàng)建一個(gè)名為 ix_class的索引,以班級號的升序排序createindexix_class收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔onstudent(clno)7)刪除ix_class索引dropindexstudent.ix_class12.1)找出所有被學(xué)生選修了的課程號selectdistinctCno課程號fromGrade2)找出01312班女生的個(gè)人信息select*fromStudentwhereClno='01311'andSsex='女'3)找出01311班和01312班的學(xué)生姓名性別出生年份selectsname學(xué)生姓名,ssex性別,2011-sage出生年份fromStudentwhereClno='01311'orClno='01312'4)找出所有姓李的學(xué)生的個(gè)人信息select*fromStudentwhereSnamelike李'%'5)找出李勇所在班級的學(xué)生人數(shù)selectCOUNT(*)fromStudentwhereClnoin(selectClnofromStudentwhereSname='李勇')收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔6)找出課程名為操作系統(tǒng)的平均成績 最高分最低分selectAVG(Gmark)平均成績,MAX(Gmark)最高分,MIN(Gmark)最低分fromGradewhereCnoin(selectCnofromCoursewhereCname='操作系統(tǒng)')7)選修了課程的學(xué)生人數(shù) ;selectCOUNT(distinctsno)學(xué)生人數(shù)fromGrade8)選修了操作系統(tǒng)的學(xué)生人數(shù) ;selectCOUNT(distinctsno)學(xué)生人數(shù)fromGradewhereCnoin(selectCnofromCoursewhereCname='操作系統(tǒng)')9)找出2000級計(jì)算機(jī)軟件班的成績?yōu)榭盏膶W(xué)生姓名selectSname學(xué)生姓名from(select*fromStudentwhereClnoin(selectClnofromClasswhereSpeciality='計(jì)算機(jī)軟件'andInyear='2000'))ruanjianwhereruanjian.Snonotin(selectdistinctSnofromGrade)withruanjianas收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔(selectSno,SnamefromStudentjoinClassonStudent.Clno=Class.ClnowhereClass.Speciality='計(jì)算機(jī)軟件'andClass.Inyear='2000')selectSname學(xué)生姓名fromruanjianwherenotexists(select*fromGradewhereruanjian.Sno=Grade.Sno)13.1)找出和李勇在同一個(gè)班級的學(xué)生信息select*fromStudentwhereSname<>'李勇'andClnoin(selectClnofromStudentwhereSname='李勇')2)找出所有與學(xué)生李勇有相同選修課程的學(xué)生信息select*fromStudentwhereSname<>'李勇'andexists(select*fromGradewhereStudent.Sno=Grade.SnoandGrade.Cnoin(selectCnofromGradewhereSnoin(selectSnofromStudentwhereSname='李勇')))3)找出年齡介于學(xué)生李勇和 25歲之間的學(xué)生信息select*fromStudentwhereSage<25andSage>(selectSagefromStudentwhereSname='李勇')4)找出選修了課程是操作系統(tǒng)的學(xué)生學(xué)號和姓名收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔selectSno學(xué)號,Sname姓名fromStudentwhereexists(select*fromGradewhereCnoin(selectCnofromCoursewhereCname='操作系統(tǒng)')andStudent.Sno=Grade.Sno)5)找出沒有選修 1號課程的所有學(xué)生姓名selectSname姓名fromStudentwherenotexists(select*fromGradewhereStudent.Sno=Grade.SnoandCno=1)6)找出選修了全部課程的學(xué)生姓名selectSname姓名fromStudentwherenotexists(selectCnofromCourseexceptselectCnofromGradewhereStudent.Sno=Grade.Sno)14.1)查詢選修了3號課程的學(xué)生學(xué)號及成績 ,并按成績的降序排列selectSno學(xué)號,Gmark成績fromGradewhereCno=3orderbyGmarkdesc2)查詢?nèi)w學(xué)生信息,要求查詢結(jié)果按班級號升序排列 ,同一班級學(xué)生按年齡降序排列select*fromStudent收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔orderbyClnoasc,Sagedesc3)求每個(gè)課程號及相應(yīng)的選課人數(shù)selectGrade.Cno課程號,COUNT(Grade.Cno)選課人數(shù)fromGradejoinCourseonGrade.Cno=Course.CnogroupbyGrade.Cno4)查詢選修了3門以上課程的學(xué)生學(xué)號selectSno學(xué)號fromGradegroupbySnohavingCOUNT(Sno)>315.1)將01311班的全體學(xué)生的成績置零updateGradesetGmark=0whereSnoin(selectSnofromStudentwhereClno='01311')2)刪除2001級計(jì)算機(jī)軟件的全體學(xué)生的選課記錄deletefromGradewhereSnoin(selectSnofromStudentwhereClnoin(selectClnofromClasswhereSpeciality='計(jì)算機(jī)軟件'andInyear='2001'))3)學(xué)生李勇已退學(xué),從數(shù)據(jù)庫中刪除有關(guān)他的記錄deletefromGradewhereSnoin(selectSnofromStudent收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔whereSname='李勇')updateClasssetNumber=Number-1whereClnoin(selectClnofromStudentwhereSname='李勇')updateClasssetMonitor=casewhenMonitor=(selectSnofromStudentwhereSname='李勇')then''endfromClasswhereClnoin(selectClnofromStudentwhereSname='李勇')deletefromStudentwhereSname='李勇'4)對每個(gè)班,求學(xué)生的平均年齡,并把結(jié)果存入數(shù)據(jù)庫altertableClassaddCagesmallintnullupdateClasssetCage=casewhenClno='00311'then(selectAVG(Sage)fromSt
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 基于大數(shù)據(jù)的閱讀趨勢預(yù)測
- 2025年海南省公需課學(xué)習(xí)-醫(yī)療衛(wèi)生服務(wù)體系規(guī)劃1119
- 2025年八大特殊作業(yè)安全填空題試題庫及答案(共50題)
- 2025年新疆初中語文題庫及答案
- 2025年策畫師游戲測試題及答案
- 租賃公司租房合同范本
- 超市員工安全 合同范本
- 資產(chǎn)收購公司合同范本
- 因政策終止合同范本
- 荒地旱地出租合同范本
- 加盟2025年房地產(chǎn)經(jīng)紀(jì)協(xié)議合同
- 2025至2030中國商業(yè)攝影行業(yè)市場發(fā)展分析及發(fā)展前景預(yù)測與投資風(fēng)險(xiǎn)報(bào)告
- 地球系統(tǒng)多源數(shù)據(jù)融合-洞察及研究
- 香水銷售知識培訓(xùn)內(nèi)容課件
- 工業(yè)產(chǎn)品早期可制造性評估標(biāo)準(zhǔn)
- DB45-T 2757.1-2023 交通運(yùn)輸行業(yè)安全風(fēng)險(xiǎn)評估規(guī)范 第1部分:總則
- 3.6運(yùn)動和能量課件-科學(xué)三年級上冊教科版-1
- 2025年酒店行業(yè)全球酒店管理與酒店服務(wù)創(chuàng)新研究報(bào)告
- 2025年及未來5年中國銅鋁復(fù)合板帶行業(yè)市場供需格局及行業(yè)前景展望報(bào)告
- Unit6Ouranimalfriends單詞詞匯(課件)-Joinin外研劍橋英語四年級上冊
- 第9課 約束教學(xué)設(shè)計(jì)-2025-2026學(xué)年初中日語人教版2024七年級全一冊-人教版
評論
0/150
提交評論