




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
數(shù)據(jù)庫原理答案西安電子科技大學精品文檔數(shù)據(jù)庫原理-西安電子科技大學出版社姓名:陳俊昌班級:10923337杭州電子科技大學計算機學院111)給學生表增加一屬性 Nation(民族),數(shù)據(jù)類型為varchar(20)altertableStudentaddnationvarchar(20)2)刪除學生表中新增的屬性 nationaltertableStudentdropcolumnnation3)向成績表中插入記錄(“2001110”,3“”,80)insertintoGrade(Sno,Cno,Gmark)values('2001110','3',80)4)將學號為“2001110”的學生成績修改為70分updateGradesetGmark=70whereSno='2001110'5)刪除學號為“2001110”的學生成績記錄deletefromGradewhereSno='2001110'6)在學生表的clno屬性上創(chuàng)建一個名為 ix_class的索引,以班級號的升序排序createindexix_class收集于網(wǎng)絡,如有侵權(quán)請聯(lián)系管理員刪除精品文檔onstudent(clno)7)刪除ix_class索引dropindexstudent.ix_class12.1)找出所有被學生選修了的課程號selectdistinctCno課程號fromGrade2)找出01312班女生的個人信息select*fromStudentwhereClno='01311'andSsex='女'3)找出01311班和01312班的學生姓名性別出生年份selectsname學生姓名,ssex性別,2011-sage出生年份fromStudentwhereClno='01311'orClno='01312'4)找出所有姓李的學生的個人信息select*fromStudentwhereSnamelike李'%'5)找出李勇所在班級的學生人數(shù)selectCOUNT(*)fromStudentwhereClnoin(selectClnofromStudentwhereSname='李勇')收集于網(wǎng)絡,如有侵權(quán)請聯(lián)系管理員刪除精品文檔6)找出課程名為操作系統(tǒng)的平均成績 最高分最低分selectAVG(Gmark)平均成績,MAX(Gmark)最高分,MIN(Gmark)最低分fromGradewhereCnoin(selectCnofromCoursewhereCname='操作系統(tǒng)')7)選修了課程的學生人數(shù) ;selectCOUNT(distinctsno)學生人數(shù)fromGrade8)選修了操作系統(tǒng)的學生人數(shù) ;selectCOUNT(distinctsno)學生人數(shù)fromGradewhereCnoin(selectCnofromCoursewhereCname='操作系統(tǒng)')9)找出2000級計算機軟件班的成績?yōu)榭盏膶W生姓名selectSname學生姓名from(select*fromStudentwhereClnoin(selectClnofromClasswhereSpeciality='計算機軟件'andInyear='2000'))ruanjianwhereruanjian.Snonotin(selectdistinctSnofromGrade)withruanjianas收集于網(wǎng)絡,如有侵權(quán)請聯(lián)系管理員刪除精品文檔(selectSno,SnamefromStudentjoinClassonStudent.Clno=Class.ClnowhereClass.Speciality='計算機軟件'andClass.Inyear='2000')selectSname學生姓名fromruanjianwherenotexists(select*fromGradewhereruanjian.Sno=Grade.Sno)13.1)找出和李勇在同一個班級的學生信息select*fromStudentwhereSname<>'李勇'andClnoin(selectClnofromStudentwhereSname='李勇')2)找出所有與學生李勇有相同選修課程的學生信息select*fromStudentwhereSname<>'李勇'andexists(select*fromGradewhereStudent.Sno=Grade.SnoandGrade.Cnoin(selectCnofromGradewhereSnoin(selectSnofromStudentwhereSname='李勇')))3)找出年齡介于學生李勇和 25歲之間的學生信息select*fromStudentwhereSage<25andSage>(selectSagefromStudentwhereSname='李勇')4)找出選修了課程是操作系統(tǒng)的學生學號和姓名收集于網(wǎng)絡,如有侵權(quán)請聯(lián)系管理員刪除精品文檔selectSno學號,Sname姓名fromStudentwhereexists(select*fromGradewhereCnoin(selectCnofromCoursewhereCname='操作系統(tǒng)')andStudent.Sno=Grade.Sno)5)找出沒有選修 1號課程的所有學生姓名selectSname姓名fromStudentwherenotexists(select*fromGradewhereStudent.Sno=Grade.SnoandCno=1)6)找出選修了全部課程的學生姓名selectSname姓名fromStudentwherenotexists(selectCnofromCourseexceptselectCnofromGradewhereStudent.Sno=Grade.Sno)14.1)查詢選修了3號課程的學生學號及成績 ,并按成績的降序排列selectSno學號,Gmark成績fromGradewhereCno=3orderbyGmarkdesc2)查詢?nèi)w學生信息,要求查詢結(jié)果按班級號升序排列 ,同一班級學生按年齡降序排列select*fromStudent收集于網(wǎng)絡,如有侵權(quán)請聯(lián)系管理員刪除精品文檔orderbyClnoasc,Sagedesc3)求每個課程號及相應的選課人數(shù)selectGrade.Cno課程號,COUNT(Grade.Cno)選課人數(shù)fromGradejoinCourseonGrade.Cno=Course.CnogroupbyGrade.Cno4)查詢選修了3門以上課程的學生學號selectSno學號fromGradegroupbySnohavingCOUNT(Sno)>315.1)將01311班的全體學生的成績置零updateGradesetGmark=0whereSnoin(selectSnofromStudentwhereClno='01311')2)刪除2001級計算機軟件的全體學生的選課記錄deletefromGradewhereSnoin(selectSnofromStudentwhereClnoin(selectClnofromClasswhereSpeciality='計算機軟件'andInyear='2001'))3)學生李勇已退學,從數(shù)據(jù)庫中刪除有關他的記錄deletefromGradewhereSnoin(selectSnofromStudent收集于網(wǎng)絡,如有侵權(quán)請聯(lián)系管理員刪除精品文檔whereSname='李勇')updateClasssetNumber=Number-1whereClnoin(selectClnofromStudentwhereSname='李勇')updateClasssetMonitor=casewhenMonitor=(selectSnofromStudentwhereSname='李勇')then''endfromClasswhereClnoin(selectClnofromStudentwhereSname='李勇')deletefromStudentwhereSname='李勇'4)對每個班,求學生的平均年齡,并把結(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)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)院物流機器人
- 幼兒衛(wèi)生課堂
- 2025自考國際經(jīng)濟學高頻考點
- 醫(yī)院面試個人簡介
- 2025經(jīng)濟師高頻考點初級
- 2025秋初中數(shù)學八年級上冊人教版(2024)教案設計 13.2.2 三角形的中線、角平分線、高
- 2025經(jīng)濟法合同重點高頻考點總結(jié)
- 臨終護理課堂匯報
- 2025甘肅省物理會考試題及答案中考
- 醫(yī)院科室團隊建設與管理
- 《水土保持監(jiān)測技術(shù)規(guī)范SLT 277-2024》知識培訓
- 電商運營知識點
- 監(jiān)理人員組織形式及監(jiān)理人員進場計劃表
- 慢性心功能不全護理個案分析
- DB37T 5118-2018 市政工程資料管理標準
- 2024年中藥炮制工技能大賽理論考試題庫(含答案)
- 中級安全工程師《安全生產(chǎn)法律法規(guī)》考試(重點)題及答案
- 韶關學院《馬克思主義基本原理概論》2021-2022學年第一學期期末試卷
- 讀后續(xù)寫 Emily 的成長 課件 -高三英語上學期二輪復習專項
- GB/T 44794-2024家用和類似用途電自動控制器微波傳感功能的技術(shù)要求和評價方法
- 鄉(xiāng)村天然氣管道鋪設合同
評論
0/150
提交評論