九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

歡迎來到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

SQL數(shù)據(jù)查詢策略

  • 資源ID:50933115       資源大小:45KB        全文頁數(shù):5頁
  • 資源格式: DOC        下載積分:10積分
快捷下載 游客一鍵下載
會員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要10積分
郵箱/手機:
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機號,方便查詢和重復下載(系統(tǒng)自動生成)
支付方式: 支付寶    微信支付   
驗證碼:   換一換

 
賬號:
密碼:
驗證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會被瀏覽器默認打開,此種情況可以點擊瀏覽器菜單,保存網(wǎng)頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無水印,預覽文檔經(jīng)過壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標題沒有明確說明有答案則都視為沒有答案,請知曉。

SQL數(shù)據(jù)查詢策略

實驗名稱:SQL數(shù)據(jù)查詢一、 實驗目的:數(shù)據(jù)查詢語句是SQL語句的重要組成部分,合理使用數(shù)據(jù)查詢語句,可以極大的簡化應 用程序編制、快速的定位分析數(shù)據(jù)庫系統(tǒng)的故障,查詢語句是編程人員與數(shù)據(jù)庫管理人員必 不可少的工具,通過實驗達到以下目的:(1 )加深學生對查詢語句基本概念的理解與掌握,最終達到靈活應用。(2)掌握SELECT語句的基本語法。(3)掌握簡單單表查詢、連接查詢、嵌套查詢。(4)學會使用聚函數(shù)和進行分組查詢。二、實驗內(nèi)容:1、單表查詢:2、連接查詢3、嵌套查詢?nèi)?、實驗環(huán)境Windows xp 系統(tǒng) SQL Server2000 服務器四、程序源碼與運行結(jié)果1、單表查詢:設(shè)計查詢語句完成對 *、distinet 、like(% 和_)、in、not in、between and、order by、group by等的應用。(1)檢索出學生信息表中所有女生的記錄。Select * from stude nt where sex='女'(2)從選課成績表中檢索出所有學生的成績,并去除重復值。select disti net grade from es(3)從課程表中檢索出全部數(shù)據(jù)的信息。select * from course where en ame like '數(shù)據(jù) %'(3)從學生信息表中檢索出姓王的學生的信息。select * from stude nt where sn ame like '王 _'(4)從成績表中找出成績等于60分的學生的性別。select sex from stude nt where sno in (select sno from cs where grade='60')(5)找出不在成績表中的學生的所有信息。select * from student where sno not in (select sno from cs)(6)在成績表中找出成績從70到85分的所有信息。select * from cs where grade betwee n 70 and 85(7) 將學生表中的所有學生的年齡按升序排列。select * from stude nt order by age(8) 檢索出沒門課程的平均分。select eno ,avg(grade) from cs group by eno2、連接查詢設(shè)計查詢語句,分別用兩種方式(where+連接條件和joinon)表示連接條件實現(xiàn)連 接查詢(1) 找出成績大于90分的姓名和他們所在的專業(yè)。(where+連接條件)select disti net sn ame,dept from stude nt,cs where (grade>90)(2) 找出成績大于85分的姓名和他們所在的專業(yè)。(joinon)select dist inct sn ame,deptfrom stude nt join cs on( stude nt.s no=cs.s no) where (grade>85)3、嵌套查詢具體要完成的任務如下:1. 查詢?nèi)w學生的學號與姓名select sno,sn ame from stude nt2. 查詢?nèi)w學生的全部信息,并為學生表命名別名。select * from stude nt W,course E ,cs B where W.sno=B.s no and E.c no=B.c no3. 查全體學生的出生年份,并為年份加上標題select 出生日期 from student4. 查詢選修了課程的學生學號,要求消除重復行select sno from stude nt where sno in (select sno from cs)5. 查詢所有年齡在20歲以下的學生姓名及其年齡。select sn ame,age from stude nt where age<206. 查詢年齡在2023歲的學生信息(要求至少使用兩種方式完成查詢)select * from stude nt where age betwee n 20 and 23(第一種)select * from stude nt where (age>=20 and age<=23)(第二種)7. 使用IN關(guān)鍵字查詢信息系(IS)、數(shù)學系(MA和計算機科學系(CS的學生select * from stude ntwhere sno in (select sno from stude nt where dept='IS')select * from stude ntwhere sno in (select sno from stude nt where dept='MA')select * from stude ntwhere sno in (select sno from student where dept='CS')8. 查詢既不是信息系、數(shù)學系,也不是計算機科學系的學生的姓名和性別。select sn ame,sex from stude ntwhere dept!='MA'a nd dept!='CS'a nd dept!='IS'9. 查詢所有姓劉學生的姓名、學號和性別。select sn ame,s no ,sex from stude nt where sn ame like '劉 %10. 查詢名字中第2個字為"陽"字的學生的姓名和學號。select sn ame,s no from stude nt where sn ame like '_陽'11. 查詢DB_Design課程的課程號和學分(先在 Course表中插入“ DB_Desigr”課程 信息)。select cn ame,score from course where cn ame='DB_Desig n'12. 查詢沒有考試成績的學生學號和課程號。select sno,cno from cs where grade is n ull13. 查詢計算機系年齡在20歲以下的學生姓名。select sn ame from stude nt where age<20 and dept='CS'14. 查詢?nèi)w學生情況,查詢結(jié)果按所在系的系號升序排列,同一系中的學生按年齡 降序排列。select * from stude nt order by dept,age desc15. 查詢學生總?cè)藬?shù)。select coun t(s no) from stude nt16. 查詢選修了課程的學生人數(shù)。select coun t(disti net sno) from cs17. 計算1號課程的學生平均成績。select avg(grade) from cs where eno='C001'18. 查詢選修1號課程的學生最高分數(shù)。select max(grade) from cs where eno='C001'19. 求各個課程號及相應的選課人數(shù)。select eno ,co un t(s no) from cs group by eno20. 查詢選修了 3門以上課程的學生學號(提示用Having字句)select sno ,co un t(c no) from cs group by sno hav ing coun t(c no) >=321、查詢有3門以上課程是90分以上的學生的學號及(90分以上的)課程數(shù)。select sno ,co un t(c no) from cs where grade>=90group by sno hav ing coun t(c no) >=322、查詢?nèi)w學生與選課表的笛卡爾積。select * from stude nt cross joi n course23、查詢每個學生及其選修課程的情況。select disti net * from stude nt cross join cs where stude nt.s no=cs.s no24、查詢每個學生及其選修課程的情況(去掉重復屬性)select a.s no,s name,sex,dept,age,b.c no,c name,score,c.gradefrom stude nt a,course b,cs c where a.s no=c.s no and b.c no=c.c no25、查詢某門課程考試成績相同的學生學號和課程信息select a.s no ,b.c no ,b.c name,b.score from cs a,course bwhere a.c no=b.c no and (select coun t(*) from cs where cno=cno and grade=grade)>=226、查詢每個學生的選修課程包括沒有選修課程的學生(外連接)select * from stude nt a,cs b where a.s no *=b.s no27、查詢每個學生的選修課程包括沒有被學生選修的課程(外連接)select * from stude nt ,cs where stude nt.s no =*cs.s no28、查詢每個學生的選修課程即包括沒有被學生選修的課程又包括沒有被學生選修的課程(全連接)select * from stude nt full join cs on stude nt.s no=cs.s no29、查詢選修2號課程且成績在90分以上的所有學生的學號、姓名select sno,sn ame from stude ntwhere sno in( select sno from cs where grade>='90'a nd eno='C002')30、查詢每個學生的學號、姓名、選修的課程名及成績select stude nt.s no,sn ame,c name,grade from stude nt,course,cswhere (stude nt.s no=cs.s no) and (course.c no=cs.c no)31、 查詢與“張三”在一個系學習的學生(IN)select * from stude ntwhere dept in( select dept from stude nt where sn ame='張三')32、查詢選修了課程名為“信息系統(tǒng)”的學生學號和姓名。select sno,sn ame from stude ntwhere sno in (select sno from cs where eno in (select eno from course where cn ame='信息系統(tǒng)')33、查詢與“張三”在同一個系學習的學生select * from stude ntwhere dept in (select dept from stude nt where sn ame='張三')34、 查詢選修了課程1或者選修了課程2的學生(要求消除重復組 UNION(select sno from cs where cno='C001' ) UNION(select sno from cs where eno='C002')35、 查詢選修了課程1或者選修了課程2的學生(要求不消除重復組 UNION ALL(select sno from cs where cno='C001' ) UNION all(select sno from cs where eno='C002')五、實驗總結(jié)通過本次試驗,掌握了使用SQL語句查詢的技巧。

注意事項

本文(SQL數(shù)據(jù)查詢策略)為本站會員(z****)主動上傳,裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng)(點擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因為網(wǎng)速或其他原因下載失敗請重新下載,重復下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!