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

正文內(nèi)容

分布式數(shù)據(jù)庫sql語句(已修改)

2024-10-31 11:52 本頁面
 

【正文】 第四章 SQL 引言 ? IBM SYSTEM R SEQUEL ? ANSI 標準 SQL 1990 ? ISO 標準 SQL 1992 ? SQL3 (SQL99) 體系結(jié)構(gòu) ? View ? Table ? File SQL ? DDL 包括完整性與安全性 ? DML SQL DDL ? 需要創(chuàng)建的結(jié)構(gòu) – Table – View – Index Create {table, view, index} name description for that . Create Table DEPT ( DEPT Number, DNAME Char(5), Budget Number( 7,2))。 SQL DDL – 續(xù) ? 索引 Create index name on table name ( index attr name list ) . Create index I1 on EMP (E)。 Create index I2 on EMP (Ename)。 ? 唯一性索引 . Create unique index I1 on EMP (E)。 SQL DDL – 續(xù) ? 聚集索引 元組按照索引值順序,物理上盡可能的存儲在一起 , 在索引值上執(zhí)行掃描( scan)操作時可以減少 I/O. . Create cluster index CI1 on EMP (E)。 基本查詢塊 ? 典型的 SQL 查詢語句格式 : select A1, A2, ..., An from r1, r2, ..., rm where P – Ais 代表屬性 – ris 代表關(guān)系 – P 是謂詞 . Select 子句 ? select 短語用于列出所有要查詢的結(jié)果屬性 . ? 例如查找 DEPT 關(guān)系中所有部門名字 select dname from DEPT ? 注意 : SQL 大小寫無關(guān) Select 子句 續(xù) ? SQL 的查詢結(jié)果中允許有重復 . ? 使用 distinct 消重復 . ? 例如:查找 DEPT 關(guān)系中所有不同名的部門名字 select distinct dname from DEPT Select 子句 續(xù) ? select 短語中可以包含 數(shù)學表達式 . ? 例如 : select S, Sname, Status ? 2 from S . Where 子句 ? where 短語由給出謂詞,其謂詞由出現(xiàn)在from 短語中的關(guān)系的屬性組成 . ? 查找所有居住在 London 并且狀態(tài)大于 20的供應(yīng)商的供應(yīng)商號 select S from S where city=‘London’ AND status 20 ? 比較操作結(jié)果可以用邏輯操作 and, or, 和 not相連 . Where 子句 續(xù) ? between 比較操作 . ? 查找狀態(tài)在 20 和 30 之間的供應(yīng)商的商號(也就是說要 , ?20 并且 ?30) select S from S where status between 20 and 30 From 子句 ? from 短語列出的關(guān)系在執(zhí)行時要被掃描 . ? 查找 employee department 的結(jié)果 select ? from EMP, DEPT where = 重命名操作 ? SQL 使用別名( alias name)對關(guān)系和屬性重命名 : oldname newname ? 查找所有供應(yīng)商的名字、商號和狀態(tài) 。 將 S 重命名為 number、將 sname 重命名為 name select sname name, s number, status from S 元組變量 ? from 短語使用別名定義元組變量 . ? 查找所有已供應(yīng)零件的供應(yīng)商名字和零件號 . select , from S sx, SP Spx where = 串操作 ? SQL 含有串匹配操作 . 末拌有兩個特殊的符號描述 : – %. 代表任意長的子串 . – _. 代表任意的單字符 . ? Find the names of all suppliers whose city name includes the substring “Main”. select sname from s where city like ‘%Main%’ 串操作 續(xù) ? SQL 包括其他串操作例如 – concatenation (using “||”) – converting from upper to lower case (and vice versa) – finding string length, extracting substrings, etc. 排序 ? List in alphabetic order the names of all suppliers locating in London city select distinct sname from S where city=?London’ order by sname ? desc 表示降序, asc 表示升序;缺省時升序 – . order by sname desc 集合操作 ? union, intersect, 和 except ? 集合操作自動消重復 集合操作 續(xù) ? Find all cities where have a supplier, a part, or both: (select city from S) union (select city from P) ? Find all cities where have both a supplier and a part. (select
點擊復制文檔內(nèi)容
教學課件相關(guān)推薦
文庫吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號-1