




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026届山东省日照专用九年级数学第一学期期末学业水平测试试题含解析
- 2026届广东省广州市从化区数学七年级第一学期期末联考试题含解析
- 2025年游戏代练分成协议
- 2025年影视剧本创作合同协议
- 2025年英语四六级协议书
- 2025年移动阿拉伯语合同协议
- 2025年医疗健康实习合同协议书
- 8月水电运维专业(变电+动力安规)练习题及参考答案
- 7月美发师四级模拟题(含参考答案)
- 2025年3月电工电子技术模拟题(含答案)
- 学校食堂食品安全风险管控清单
- DB54/T 0316-2024藏香生产技术规程
- 车间8s管理制度培训
- 电力行业职业健康卫生管理制度
- 新22J01 工程做法图集
- 口腔诊所医患沟通与纠纷处理预案
- 奋斗青春勇担历史使命
- 《数据中心铅酸蓄电池应用技术规程》
- 钩针课件教学课件
- 起重机械吊具、索具检查记录表(钢丝绳)
- 2024时事政治考试100题及参考答案
评论
0/150
提交评论