




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、Database Chapter Four OutlineChapter 4: Advanced SQLSQL Data Types and SchemasEXACT(field from d)CAST e AS tcreate type Dollars as numeric (12,2) finalcreate domain person_name char(20) not nullTypes and domains are similar. Domains can have constraints, such as not null, specified on them. Domains
2、are not strongly typed.Domain ConstraintsDomain constraints are the most elementary form of integrity constraint. They test values inserted in the database, and test queries to ensure that the comparisons make sense. Large-Object TypesLarge objects (photos, videos, CAD files, etc.) are stored as a l
3、arge object:blob: binary large object - object is a large collection of uninterpreted binary data (whose interpretation is left to an application outside of the database system)clob: character large object - object is a large collection of character dataWhen a query returns a large object, a pointer
4、 is returned rather than the large object itself.Constraints on a Single Relationnot nullprimary keyunique check (P ), where P is a predicateCandidate keys are permitted to be null unless they have explicitly been declared to be not null (in contrastto primary keys).create table depositor(customer_n
5、amechar(20),account_numberchar(10),primary key (customer_name, account_number),foreign key (account_number ) references account,foreign key (customer_name ) references customer )Assertionscreate assertion check Forms of authorization on parts of the database:Read - allows reading, but not modificati
6、on of data.Insert - allows insertion of new data, but not modification of existing data.Update - allows modification, but not deletion of data.Delete - allows deletion of data.Authorization Specification in SQLThe grant statement is used to confer authorizationgrant on to grant select on branch to U
7、1 with grant optionRevoking Authorization in SQLrevoke select on branch from U1, U2, U3Trigger Example in SQL:1999 ECA(Event-Condition-Action model)Create trigger overdraft-trigger after update on account referencing new row as nrow for each rowwhen nrow.balance 0referencing old row as : for deletes
8、 and updatesreferencing new row as : for inserts and updates SQL Functionscreate function account_count (customer_name varchar(20)returns integer begin declare a_count integer; select count (* ) into a_count from depositor where depositor.customer_name = customer_name return a_count; endcreate funct
9、ion accounts_of (customer_name char(20)returns table ( account_number char(10),branch_name char(15),balance numeric(12,2)SQL Proceduresdeclare a_count integer;call account_count_proc( Smith, a_count);ODBCOpen DataBase Connectivity(ODBC) standard standard for application program to communicate with a
10、 database server.application program interface (API) to open a connection with a database, send queries and updates, get back results.Applications such as GUI, spreadsheets, etc. can use ODBCJDBCJDBC is a Java API for communicating with database systems supporting SQLJDBC supports a variety of features for querying and updating data, and for retrieving query resultsJDBC also supports metadata retrieval, such as querying about relations present in the database and the names and types of relation attributesModel for communicating with
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- DB13T 5150-2019 電梯維護(hù)保養(yǎng)安全管理規(guī)范
- DB13T 2908-2018 早春大棚西瓜水肥一體化技術(shù)規(guī)程
- DB13T 5011-2019 鋼絲(鋼筋)焊接網(wǎng)通 用技術(shù)要求
- 畢節(jié)教育科研課題申報(bào)攻略指南(參考模板)
- 博物館文物數(shù)字化保護(hù)與修復(fù)技術(shù)輸出企業(yè)制定與實(shí)施新質(zhì)生產(chǎn)力項(xiàng)目商業(yè)計(jì)劃書
- 胚胎植入前遺傳學(xué)檢測(cè)企業(yè)制定與實(shí)施新質(zhì)生產(chǎn)力項(xiàng)目商業(yè)計(jì)劃書
- 貞豐教師面試題目及答案
- 浙江省心理健康b證考試試題及答案
- 八年級(jí)地理上冊(cè)月考試卷及答案【完整版】
- 院感考試試題及答案新冠
- 《行政法與行政訴訟法》期末復(fù)習(xí)題及參考答案
- 電休克mect專題知識(shí)講座
- 115個(gè)低風(fēng)險(xiǎn)組病種目錄
- GB∕T 21448-2017 埋地鋼質(zhì)管道陰極保護(hù)技術(shù)規(guī)范
- 麥克維爾冷水機(jī)組
- 北京市教育系統(tǒng)
- 《科學(xué)技術(shù)史》課程課件(完整版)
- 超星爾雅學(xué)習(xí)通《大學(xué)生創(chuàng)業(yè)基礎(chǔ)》章節(jié)測(cè)試含答案
- PMBOK指南(第5版)第三章習(xí)題
- 炒股一招先100全集精華筆記-陳浩
- 服裝制衣廠常用縫紉機(jī)衣車中英文對(duì)照表單針平車NEEDLE
評(píng)論
0/150
提交評(píng)論