数据库课件总结:Database Chapter Four Outline_第1页
数据库课件总结:Database Chapter Four Outline_第2页
数据库课件总结:Database Chapter Four Outline_第3页
数据库课件总结:Database Chapter Four Outline_第4页
数据库课件总结:Database Chapter Four Outline_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论