- 0
- 0
- 约7.32千字
- 约 34页
- 2019-06-14 发布于湖北
- 举报
关系模型跟oracle对象关系数据库资料
第三章 关系模型及oracle对象关系数据库 关系的定义 关系(relation):一个关系对应一张二维表 元组(tuple):表中的一行即为一个元组 属性(attribute):表中的一列为一个属性,给每个属性起一个名字即属性名(ID,NAME,PHONE,SALES-REP-ID) 主码(primary key):表中的某个属性组,它可以唯一确定元组。each row of data in a table is uniquely identified by a primary key. It must contain a value 外码(foreign key):you can logically relate information from multiple tables using foreign keys. 关系模型 关系模型由关系数据结构,关系操作和关系完整性约束三部分组成。 数据结构 ——关系(二维表),它由行和列组成。 关系操作——常见的关系操作包括:选择select,投影project,连接join,除divide,并union,交intersection,差difference等查询query操作和增加insert,删除delete,修改update操作两大部分。 完整性——关系的三类完整性约束 实体完整性 、参照完整性、用户定义的完整性 关系代数 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 (1) Select Operation – Example Notation: ? p(r) p is called the selection predicate Defined as: ?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: attribute op attribute or constant where op is one of: =, ?, , ?. . ? Example of selection: ? branch-name=“Perryridge”(account) (2) Project Operation – Example Relation r: 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 ?account-number, balance (account) (3) Union Operation – Example Relations r, s: Notation: r ? s Defined as: r ? s = {t | t ? r or t ? s} For r ? s to be valid: 1. r, s must have the same arity (等目,同元,same number of attributes) 2. The attribute domains must be compatible (e.g., 2nd column of r deals with the same type of values as does the 2nd
您可能关注的文档
最近下载
- 河南省许昌市村庄名字.doc VIP
- 河北省邢台市信都区2024-2025学年七年级上学期期末历史试题(含答案).pdf VIP
- 河北省廊坊市香河县2025-2026学年七年级上学期1月期末考试道德与法治试卷(含答案).pdf VIP
- 2025-2026学年七年级道德与法治期末测试卷(考试版)【河北专用,测试范围:七年级上册全册】.pdf VIP
- 九年级化学金属活动性强弱的判断及反应先后顺序问题.docx VIP
- (河北专版)人教版七年级历史上册期期末测试卷.doc VIP
- 压铸成形工艺与模具设计(全套577页课件课件)-(1).pptx VIP
- 冀教版七年级生物上册期末测试卷(可打印).doc VIP
- 美国国立卫生研究院卒中量表(NIHSS).pdf VIP
- 子宫颈上皮内病变相关病理学问题-2011广州.ppt VIP
原创力文档

文档评论(0)