版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
數(shù)據(jù)庫原理答案西安電子科技大學(xué)精品文檔數(shù)據(jù)庫原理-西安電子科技大學(xué)出版社姓名:陳俊昌班級:10923337杭州電子科技大學(xué)計算機學(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)建一個名為 ix_class的索引,以班級號的升序排序createindexix_class收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔onstudent(clno)7)刪除ix_class索引dropindexstudent.ix_class12.1)找出所有被學(xué)生選修了的課程號selectdistinctCno課程號fromGrade2)找出01312班女生的個人信息select*fromStudentwhereClno='01311'andSsex='女'3)找出01311班和01312班的學(xué)生姓名性別出生年份selectsname學(xué)生姓名,ssex性別,2011-sage出生年份fromStudentwhereClno='01311'orClno='01312'4)找出所有姓李的學(xué)生的個人信息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級計算機軟件班的成績?yōu)榭盏膶W(xué)生姓名selectSname學(xué)生姓名from(select*fromStudentwhereClnoin(selectClnofromClasswhereSpeciality='計算機軟件'andInyear='2000'))ruanjianwhereruanjian.Snonotin(selectdistinctSnofromGrade)withruanjianas收集于網(wǎng)絡(luò),如有侵權(quán)請聯(lián)系管理員刪除精品文檔(selectSno,SnamefromStudentjoinClassonStudent.Clno=Class.ClnowhereClass.Speciality='計算機軟件'andClass.Inyear='2000')selectSname學(xué)生姓名fromruanjianwherenotexists(select*fromGradewhereruanjian.Sno=Grade.Sno)13.1)找出和李勇在同一個班級的學(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)求每個課程號及相應(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級計算機軟件的全體學(xué)生的選課記錄deletefromGradewhereSnoin(selectSnofromStudentwhereClnoin(selectClnofromClasswhereSpeciality='計算機軟件'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)對每個班,求學(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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年一級建造師考試核心知識點與實操題庫大全
- 2026年鋼琴演奏基本技術(shù)與音樂鑒賞考核題
- 2026年社交媒體營銷技巧與實踐能力試題
- 2026年英語教育托福聽力技巧與解題策略題庫
- 2026年語言培訓(xùn)教師課堂組織實操練習(xí)題
- 2026年電氣工程師考試電工基礎(chǔ)理論試題解析
- 2026年金融分析師投資策略分析題集
- 2026年房地產(chǎn)銷售顧問專業(yè)知識筆試模擬題
- 2026年編程達(dá)人進(jìn)階訓(xùn)練算法與數(shù)據(jù)結(jié)構(gòu)核心題集
- 2026年物流管理專業(yè)知識測試題及解析手冊
- 2025年及未來5年市場數(shù)據(jù)中國軟包裝用復(fù)合膠行業(yè)市場調(diào)研分析及投資戰(zhàn)略咨詢報告
- 斜拉橋的未來發(fā)展
- 柴油發(fā)電機操作與維護(hù)手冊
- 巡察流程培訓(xùn)會課件
- 項目管理施工合同范本
- 全國物業(yè)管理法律法規(guī)及案例解析
- 抖音來客本地生活服務(wù)酒旅酒店民宿旅游景區(qū)商家代運營策劃方案
- 北侖區(qū)打包箱房施工方案
- 車載光通信技術(shù)發(fā)展及無源網(wǎng)絡(luò)應(yīng)用前景
- 2026屆上海市金山區(qū)物理八年級第一學(xué)期期末調(diào)研試題含解析
- 2026年數(shù)學(xué)競賽希望杯-三年級100題培訓(xùn)題練習(xí)含答案
評論
0/150
提交評論