freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)庫系統(tǒng)概論(1)-免費閱讀

2025-06-10 03:05 上一頁面

下一頁面
  

【正文】 202115129 39。; IS_S中插入一個新的學生記錄:202115129,趙新, 20歲 INSERT INTO IS_Student VALUES(‘95029’,‘趙新’,20); INSERT INTO Student(Sno, Sname, Sage, Sdept) VALUES(‘202115129 39。 CREATE VIEW S_G (Sno, Gavg) AS SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno; 錯誤: SELECT Sno, AVG(Grade) FROM SC WHERE AVG(Grade)=90 GROUP BY Sno; 正確: SELECT Sno, AVG(Grade) FROM SC GROUP BY Sno HAVING AVG(Grade)=90; 更新視圖 UPDATE IS_Student SET Sname= 39。 AND = AND = 39。 ? 刪除操作:自動加上條件Sdept= 39。 ? 將師焉然的年齡設置為 40歲,性別為‘女’,所在系為‘ En’ Update student set sage=40, ssex=‘女’ , sdept=‘En’ where sname=‘師焉然’ 。 ? 查詢?nèi)w學生的信息,結(jié)果按系號升序排序,同一個系的同學按年齡降序排序 Select * from student Order by Sdept, Sage desc。 ? 查詢 IS,MA和 CS系的學生的姓名和性別 Select Sname, Ssex from student where Sdept=‘IS’ or Sdept=‘MA’ or Sdept=‘CS’ 。 Create table course( Cno char(6) primary key, Cname char(10) not null unique, Cpno char(6), Ccredit INT, constraint c1 check Ccredit0)。 課堂練習 ? 創(chuàng)建教材 P74頁第 5題的 SPJ數(shù)據(jù)庫(包括表,表的主碼,外碼) ? 修改表 P增加兩個約束: ? weight1 ? Color的默認值是‘紅’ 查詢語句的完整格式 Select [all | distinct] 目標列表達式 [別名 ][, 目標列表達式 [別名 ]]… From 表名或視圖名 [別名 ][, 表名或視圖名 [別名 ]]… Where 條件表達式 Group by 列名 [having 條件表達式 ] Order by 列名 1 [ASC | Desc] [, 列名 1 [ASC | Desc]] 例 ? Student(Sno,Sname,Ssex,Sage,Sdept) ? Course(Cno,Cname,Cpno,Ccredit) ? SC(Sno,Cno,Grade) 單表查詢 ? 查詢?nèi)w學生的學號和姓名 Select Sno,Sname from Student。 Select Sname,Ssex from student where Sdept in (‘IS’,’CS’,’MA’)。 The customer Relation The depositor Relation A B ? ? ? ? ? ? ? ? C 7 7 3 10 sumC 27 關(guān)系 r : g sum(c) (r) : branchname accountnumber balance Perryridge Perryridge Brighton Brighton Redwood A102 A201 A217 A215 A222 400 900 750 750 700 關(guān)系 account grouped by branchname: branchname balance Perryridge Brighton Redwood 1300 1500 700 branchname g sum(balance) (account) 一般的分組統(tǒng)計查詢有哪些? 聚集查詢 : ? 查詢學生人數(shù) Select count(*) from student Select count(Sno) from student ? 查詢選修了課程的學生人數(shù) Select count(distinct Sno) from SC ? 計算 1號課程的學生總分、最高分和最低分 Select sum(grade) as total, max(grade) as max, min(grade) as min From SC where Cno=‘1’ ? 查詢各門課程的課程號及其選課人數(shù) Select Cno, count(Sno) from SC group by Cno ? 查詢選修了 3門以上課程的學生學號 Select Sno from SC group by Sno having count(Cno)=3 聚集查詢 ? 五種統(tǒng)計函數(shù) ? Having 和 where 的區(qū)別 ? 有 where又有分組時,誰先執(zhí)行? ? 在聚集查詢中 , select 目標列 只能是 group by中出現(xiàn)的字段,或者聚集函數(shù)。 數(shù)據(jù)更新與約束完整性 ? 如果在 SC中插入一條記錄(‘ 95009’, 5,87),有沒有不完整的地方? ? 在 student中刪除 Eva 這條記錄呢 ? 將 SC中的 95001修改為 95003呢 sno sage 95001 95002 21 20 sdept IS CS sname Eva Mark student sno grade 95001 95001 95002 80 77 75 o 1 2 1 SC 索引及其加速查詢的作用 6 33 39 41 52 55 69 77 78 81 [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] key=69 順序查找 6 O(n) 無需排序 二分查找 4 O(lg n) 需要排序 Number Record Record Name Address 29 31 42 51 63 70 72 81 90 98 8 4 3 6 9 1 5 2 7 10 1 2 3 4 5 6 7 8 9 10 Number 70 81 42 31 72 51 90 29
點擊復制文檔內(nèi)容
范文總結(jié)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1