資源描述:
《sql server 2000表的查詢答案》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫。
1、《SQLServer數(shù)據(jù)庫基礎(chǔ)》實(shí)驗(yàn)報告實(shí)驗(yàn)六SQLServer2000表的查詢一、目的要求:掌握表的查詢,學(xué)會使用查詢語句。二、內(nèi)容步驟:(教材上機(jī)練習(xí)題)打開每題輸入完都先后執(zhí)行、。1:SELECTALL*FROMauthors2:SELECTtitle,price,pubdateFROMtitles3:SELECTtitle_id,title,price*0.8asNewPriceFROM《SQLServer數(shù)據(jù)庫基礎(chǔ)》實(shí)驗(yàn)報告titles4:USEpubsSELECTDISTINCTtypeFROMtitles5:USEpubsSELECTau_lname,au_fna
2、me,phoneFROMauthorswherestate='CA'6:USEpubsSELECTtitleFROMtitleswhereprice<10ANDtype='business'《SQLServer數(shù)據(jù)庫基礎(chǔ)》實(shí)驗(yàn)報告7USEpubsSELECTALL*FROMtitlesWHEREpriceBETWEEN10AND20:8:USEpubsSELECTALL*FROMtitlesWHEREprice<10orprice>209:USEpubsSELECTALL*FROMauthorsWHEREcity='Oakland'ORcity='Covelo'ORcity='
3、PaloAlto'10:USEpubsSELECTALL*FROMauthorsWHEREau_fnameLIKE('____')《SQLServer數(shù)據(jù)庫基礎(chǔ)》實(shí)驗(yàn)報告ORDERBYau_lname11:USEpubsSELECTALL*FROMauthorsWHEREau_lnameLIKE('S%')ANDau_fnameLIKE('%e%')12USEpubsSELECTALL*FROMauthorsWHEREau_lnameLIKE'[A~K]%'13:USEpubsSELECTMAX(price)as最高價格,MIN(price)最低價格,SUM(price)as總
4、價格,AVG(price)as平均價格FROMtitles14:USEpubsSELECTCOUNT(DISTINCT(type))as圖書種類FROMtitles《SQLServer數(shù)據(jù)庫基礎(chǔ)》實(shí)驗(yàn)報告15:USEpubsSELECTCOUNT(*)AS加利福亞洲作者人數(shù)FROMauthorswherestate='CA'16:USEpubsSELECTstateAS州名,COUNT(au_id)AS該州作者人數(shù)FROMauthorsGROUPBYstate17:USEpubsSELECTtypeAS圖書分類,AVG(price)AS平均價格FROMtitlesGROUPBY
5、type《SQLServer數(shù)據(jù)庫基礎(chǔ)》實(shí)驗(yàn)報告18:USEpubsSELECTtitleAS書名,typeAS類型,priceAS單價FROMtitlesORDERBYtypeCOMPUTEAVG(price)BYtype三、實(shí)驗(yàn)心得:(主要包括實(shí)驗(yàn)中碰到的問題,及如何解決該問題的;已經(jīng)掌握和有待掌握的內(nèi)容等)這部分內(nèi)容自我感覺是很較容易的,每一題之間互不影響,不想前兩節(jié)那樣,上一題的結(jié)果將影響下一題。很多問題過了就忘了,以后再課上應(yīng)該多問老師,把問題當(dāng)場解決。