版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、-PAGE . z.西北師*大學計算機科學與工程學院學生實驗報告學 號專業(yè)計算機科學與技術*課程名稱數(shù)據(jù)庫應用與開發(fā)班級實驗名稱Transact-SQL語句的高級應用課程類型專業(yè)限選課實驗目的:利用SELECT語句中更復雜的特性,可以使用多個表進展查詢并獲取結(jié)果。在實際應用過程中,SELECT語句查詢通常是由多表連接、子查詢等有機地組合而形成的,同時還可以處理大型數(shù)據(jù)塊,使用游標處理結(jié)果集。 實驗內(nèi)容:1、查詢每一位教授的教師號、*和講授的課程名稱SQL代碼:use teachinggoselect teacherno as教授號, tname as*, major as課程名稱from te
2、acherwhere prof=教授go實驗結(jié)果:2、利用現(xiàn)有的表生成新表,新表中包括*、學生*、課程名稱和總評成績其中:總評成績=final*0.9+usually*0.1。SQL代碼:use teachinggoselect student.studentno as*, sname as學生*, ame as課程名稱,0.9*final+0.1*usually as總評成績into new_stuscorefrom student, score, coursewhere student.studentno = score.studentno and course.courseno = sc
3、ore.coursenogoselect*from new_stuscore實驗結(jié)果:3、分別統(tǒng)計每個學生期末成績高于75分的課程門數(shù)SQL代碼:use teachinggoselect student.studentno ,student.sname,count(*)as課程門數(shù)from score,studentwhere final 75 and student.studentno = score.studentnogroupby student.studentno,student.sname實驗結(jié)果:4、輸出student表中年齡大于女生平均年齡的男生的所有信息SQL代碼:use te
4、aching goselect*from studentwhere se*=男anddatediff(year,birthday,getdate()(selectavg(datediff(year,birthday,getdate()from studentwhere se*=女)實驗結(jié)果:5、計算每個學生獲得的學分。SQL代碼:use teachinggoselect student.studentno, student.sname,sum(credit)from student innerjoin scoreon student.studentno=score.studentnoinner
5、join courseon course.courseno = score.coursenowhere score.final 60groupby student.studentno, student.snamego實驗結(jié)果:6、獲取入學時間在20082009年的所有學生中入學年齡小于19歲的*、*及所修課程的課程名稱。SQL代碼:use teachinggoselect student.studentno, student.sname, course.amefrom student innerjoin scoreon student.studentno = score.studentnoin
6、nerjoin courseon course.courseno = score.coursenowhere(substring(student.studentno,1,2)=08and(datediff(year,birthday,2008-01-01) 19)or(substring(student.studentno,1,2)=09and(datediff(year,birthday,2009-01-01) 19)go實驗結(jié)果:7、查詢09級學生的*、*、課程名及學分。SQL代碼:use teachinggoselect student.studentno, student.sname,
7、 course.ame,course.creditfrom student innerjoin scoreon student.studentno = score.studentnoinnerjoin courseon course.courseno = score.coursenowhere(substring(student.studentno,1,2)=09)go實驗結(jié)果:8、查詢選修課程少于3門或期末成績含有60分以下課程的學生*、*、和.SQL代碼:use teachinggoselect studentno,count(*)ascountNUMinto count1from scoregroupby studentnogoselect student.syudentno,sname,phone,Emailfrom student innerjoin scoreon student.studentno=score.studentnoinnerjoin count1on student.studentno=co
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 成都2025年成都高新區(qū)面向社區(qū)黨組織書記考核招聘事業(yè)單位人員筆試歷年參考題庫附帶答案詳解
- 徐州徐州市2025年“三支一扶”服務期滿考核合格人員專項招聘25人筆試歷年參考題庫附帶答案詳解
- 廣西2025年廣西財經(jīng)學院招聘中國-東盟統(tǒng)計學院高層次人才筆試歷年參考題庫附帶答案詳解
- 廣州2025年廣東廣州醫(yī)科大學附屬醫(yī)院第四次招聘29人筆試歷年參考題庫附帶答案詳解
- 廣東廣東興寧市2025年“歸雁”引才筆試歷年參考題庫附帶答案詳解
- 2026北京市西城區(qū)衛(wèi)生健康系統(tǒng)第一批事業(yè)單位招聘328人備考題庫及1套完整答案詳解
- 2026山東省淄博第十一中學招聘11人備考題庫及答案詳解1套
- 2026北京航空航天大學計算機學院聘用編產(chǎn)品設計工程師F崗招聘1人備考題庫含答案詳解
- 2025年淮南市部分高中引進緊缺專業(yè)人才80人備考題庫(二)及一套完整答案詳解
- 2026北京順義區(qū)石園社區(qū)衛(wèi)生服務中心第一批招聘編外23人備考題庫及參考答案詳解
- 利潤分成增加合同范本
- DB45∕T 2177-2020 糖料甘蔗入廠規(guī)程
- 幕墻施工安全管理培訓課件
- 員工考勤記錄表模板(2024Excel版)
- 數(shù)據(jù)拷貝保密協(xié)議書模板
- 磁力泵無泄漏市場前景磁鐵試題(附答案)
- GJB373B-2019引信安全性設計準則
- 2025年藥品效期管理制度測試卷(附答案)
- 工業(yè)管道安裝施工組織設計方案
- 紡織車間設計方案(3篇)
- 浙江省義烏小商品出口貿(mào)易問題研究
評論
0/150
提交評論