




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年無線通信工程師考試題及答案
- 2025年投資理財師考試試卷及答案
- 2025年衛生政策與公共健康管理專業綜合素質測試卷及答案
- Lactaroviolin-生命科學試劑-MCE
- 2025年民族文化保護與傳承考試試卷及答案
- 2025年國際商務溝通與協調考試試卷及答案
- 2025年廣告傳播學考試試卷及答案
- 2025年工程管理師考試試題及答案
- 金融服務投資經驗證明書(7篇)
- 促進計量智能化轉型實施方案
- 18.V2X技術在智能網聯車上的應用
- NSTEMI指南解讀課件
- 北京市教育系統
- 《科學技術史》課程課件(完整版)
- 西北工業大學數電實驗報告二Quartus和Multisim
- k受體激動劑在臨床中的應用
- 超星爾雅學習通《大學生創業基礎》章節測試含答案
- 第四節-酸堿平衡失常的診治課件
- 國家學生體質健康標準登記卡高中樣表
- 通用焊接工藝規范
- 服裝制衣廠常用縫紉機衣車中英文對照表單針平車NEEDLE
評論
0/150
提交評論