數(shù)據(jù)庫課件總結(jié):Database Chapter Four Outline_第1頁
數(shù)據(jù)庫課件總結(jié):Database Chapter Four Outline_第2頁
數(shù)據(jù)庫課件總結(jié):Database Chapter Four Outline_第3頁
數(shù)據(jù)庫課件總結(jié):Database Chapter Four Outline_第4頁
數(shù)據(jù)庫課件總結(jié):Database Chapter Four Outline_第5頁
已閱讀5頁,還剩2頁未讀 繼續(xù)免費(fèi)閱讀

VIP免費(fèi)下載

版權(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論