关系模型及oracle对象关系数据库.pptx

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实体完整性 、参照完整性、用户定义的完整性
返回
关系代数
The relational algebra(关系代数) is the basis of SQL.
Basic Structure ——Cartesian product(笛卡儿积)
Formally, given sets D1, D2, …. Dn a relation r is a subset of D1 x D2 x … x Dn , Thus a relation is a set of n-tuples (a1, a2, …, an) where each ai Di
Relation r:
A,C (r)
ABC
10 1 20 1 30 1 40 2
AC
AC
1
1
1百度文库= 1
1
2
2
Notation:
A1, A2, …, Ak (r) where A1, A2 are attribute names and r is a relation name. The result is defined as the relation of k columns obtained by erasing the columns that are not listed Duplicate rows removed from result, since relations are sets E.g. To eliminate the branch-name attribute of account
(刘 逸,信 息,王名 ) },
共12个元组。笛卡儿积可对应一张二维表。
basic operators
Set intersection 交
Union 并 set difference 差(集合差) Cartesian product 笛卡儿积 Select 选择 Project 投影 Natural join 自然连接 Division 除 The operators take two or more relations as inputs and give a new relation as a result.
(1) Select Operation – Example
• Relation r
ABCD
1 7 57 12 3 23 10
• A=B ^ D > 5 (r) ABCD
1 7 23 10
注:选择条件必须是针对 同一元组中的相应属性值 进行比较
Notation: p(r)
p is called the selection predicate Defined as:
Vendors: ORACLE(9i ),IBM(DB2) , Microsoft (ACESS and SQLServer), Foxbase(Foxpro), Sybase
关系的定义
关系(relation):一个关系对应一张二维表 元组(tuple):表中的一行即为一个元组 属性(attribute):表中的一列为一个属性,给每个属性起
Example of Cartesian product
例如, D1=导师集合= {张清玫,刘逸}, D2 =专业集合= {计算机,信息}, D3 =研究生集合={ 李勇,刘晨,王名}
则 D1 X D2 X D3 ={ (张清玫,计算机,李勇 ) ,
(张清玫,计算机,刘晨 ) , (张清玫,计算机,王名 ) , (张清玫,信 息,李勇 ) , (张清玫,信 息,刘晨 ) , (张清玫,信 息,王名 ) , (刘 逸,计算机,李勇 ) , (刘 逸,计算机,刘晨 ) , (刘 逸,计算机,王名 ) , (刘 逸,信 息,李勇 ) , (刘 逸,信 息,刘晨 ) ,
外码(foreign key):you can logically relate information
from multiple tables using foreign keys.
关系模型
关系模型由关系数据结构,关系操作和关系完整性约束三 部分组成。 数据结构 ——关系(二维表),它由行和列组成。 关系操作—— 常见的关系操作包括:选择select,投影project,连接join, 除divide,并union,交intersection,差difference等查询 query操作和增加insert,删除delete,修改update操作两 大部分。 完整性——关系的三类完整性约束
第三章 关系模型及oracle对 象关系数据库
3.1 关系模型和基本概念
3.2 关系代数
3.3 oracle对象关系数据库系统
关系数据库系统是支持关系模型的数据库系统。
1970年初,IBM公司的高级研究员 Dr.E.F.Codd发表论文提出了关系模型,奠定了 关系数据库的理论基础。Dr.E.F.Codd proposed the relational model for database systems in 1970s.
一个名字即属性名(ID,NAME,PHONE,SALESREP-ID)
主码(primary key):表中的某个属性组,它可以唯一确定
元组。each row of data in a table is uniquely identified by a primary key. It must contain a value
<attribute> op <attribute> or <constant> where op is one of: =, , >, . <. Example of selection:
branch-name=“Perryridge”(account)
(2) Project Operation – Example
p(r) = {t | t r and p(t)}
Where p is a formula in propositional calculus consisting of terms connected by : (and), (or), (not) Each term is one of:
相关文档
最新文档