1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.

Slides:



Advertisements
Similar presentations
Database Management Systems Chapter 3 The Relational Data Model (I) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
Advertisements

1 Relational Algebra Operators Expression Trees. 2 What is an “Algebra” uMathematical system consisting of: wOperands --- variables or values from which.
CSCI 305 – Fall 2013 The Entity-Relationship Model Based on Slides by Prof. Brian King.
概率统计( ZYH ) 节目录 3.1 二维随机变量的概率分布 3.2 边缘分布 3.4 随机变量的独立性 第三章 随机向量及其分布 3.3 条件分布.
空间群 space groups 晶轴和直角坐标轴
1 Convert E/R to Relation May 18, Entity Set -> Relation Relation: Beers(name, manf) Beers name manf.
Databases : Relational Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman distributes.
Entity-Relationship Model
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
1 Relational Model and Translating ER into Relational.
4 第四章 矩阵 学时:  18 学时。 教学手段:  讲授和讨论相结合,学生课堂练习,演练习题与辅导答疑相结合。 基本内容和教学目的:  基本内容: 矩阵的运算,可逆矩阵,初等矩阵及其性质和意义, 分块矩阵。  教学目的:  1 .使学生理解和掌握矩阵等价的相关理论  2 .能熟练地进行矩阵的各种运算.
第二章 质点组力学 质点组:许多(有限或无限)相 互联系的质点组成的系统 研究方法: 1. 分离体法 2. 从整体考虑 把质点的三个定理推广到质点组.
3 .计算题(原创) 草酸的分布分数图为 图中 A , B , C , D 四点的关系如何?请用数学推导进行说 明。
地理信息系统概述. 数据和信息 (Data & Information) 数据 原始事实 如:员工姓名, 数据可以有数值、图形、声音、视觉数据等 信息 以一定规则组织在一起的事实的集合。
The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes rows: tuples Complex file.
1 Announcement Recitation time  Before midterm: 6-7pm, by Earl Wagner  After midterm: 5-6pm, by Yi Qiao Newsgroup safe to subscribe  Will not cause.
1 为了更好的揭示随机现象的规律性并 利用数学工具描述其规律, 有必要引入随 机变量来描述随机试验的不同结果 例 电话总机某段时间内接到的电话次数, 可用一个变量 X 来描述 例 检测一件产品可能出现的两个结果, 也可以用一个变量来描述 第五章 随机变量及其分布函数.
第七章 非公司企业. 第一节 个人独资企业 一、个人独资企业的概念 个人独资企业,是指由一个自然人投资,全 部资产为投资人所有的营利性经济组织。
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第三十八讲 ) 离散数学. 第八章 格与布尔代数 §8.1 引 言 在第一章中我们介绍了关于集 合的理论。如果将 ρ ( S )看做 是集合 S 的所有子集组成的集合, 于是, ρ ( S )中两个集合的并 集 A ∪ B ,两个集合的交集.
第二部分 行政法律关系主体 第一节 行政主体 一、行政主体 (一)行政主体的概念 cc (二)行政主体资格含义及构成要件 CASE1CASE1\CASE2CASE2 (三)行政主体的职权和职责 1 、行政职权的概念及内容 2 、行政职权的特点 3 、行政职责.
线性代数习题课 吉林大学 术洪亮 第一讲 行 列 式 前面我们已经学习了关 于行列式的概念和一些基本 理论,其主要内容可概括为:
6 第一章 线性空间 学时: 16 学时。 教学手段:  讲授和讨论相结合,学生课堂练习,演练习题与辅导答疑相结合。 基本内容和教学目的:  基本内容:集合、映射的概念;线性空间的定义与简单性质、维 数、基与坐标、过渡矩阵的概念;基变换与坐标变换;线性子空 间、子空间的交与和、子空间的直和;线性空间的同构等概念。
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第三十九讲 ) 离散数学. 例 设 S 是一个集合, ρ ( S )是 S 的幂集合,集合 的交( ∩ ),并(∪)是 ρ ( S )上的两个代数运算, 于是,( ρ ( S ), ∩ ,∪) 是一个格。而由例 知.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
From E/R Diagrams to Relations. The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes.
吉林大学远程教育课件 主讲人 : 杨凤杰学 时: 64 ( 第四十五讲 ) 离散数学 模 格 定义 设( L , ≤ ) 是一个格,对任意 a , b , c ∈ L , 如果 a≤b ,都有 a  ( b×c ) = b× ( a  c ) 则称( L , ≤ )为模格。
非均相物系的分离 沉降速度 球形颗粒的 :一、自由沉降 二、沉降速度的计算 三、直径计算 1. 试差法 2. 摩擦数群法 四、非球形颗粒的自由沉降 1. 当量直径 de :与颗粒体积相等的圆球直径 V P — 颗粒的实际体积 2. 球形度  s : S—— 与颗粒实际体积相等的球形表面积.
操作系统原理课程设计指南 姜海燕 设计考核幻灯制作  1.1 封皮:系统名称,研制人员  1.2 目的及意义  1.3 功能设计:功能框图、用例图  1.4 结构设计:系统结构  1.5 核心技术及技术路线:画图  1.6 进度安排  1.7 人员安排  1.8.
UML 对象设计与编程 主 讲 : 董兰芳 副教授 Dept. of Computer Science,USTC
Fall 2001Arthur Keller – CS 1803–1 Schedule Today Oct. 2 (T) Relational Model. u Read Sections Assignment 1 due. Personal Letter of Introduction.
Chapter 4 OPTIMIZED IMPLEMENTATION OF LOGIC FUNCTIONS 优化.
湖南省赛宝软件服务有限公司 信息报送及申报系统演示 湖南省赛宝软件服务有限公司 李纠.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Source: slides by Jeffrey Ullman.
Department of Mathematics 第二章 解析函数 第一节 解析函数的概念 与 C-R 条件 第二节 初等解析函数 第三节 初等多值函数.
Chapter 4 Rational data model. Chapter 5 Rational data model Chapter 4 Rational data model.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
1 Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
§10.2 对偶空间 一、对偶空间与对偶基 二、对偶空间的有关结果 三、例题讲析.
表单自定义 “ 表单自定义 ” 功能是用于制作表单的 工具,用数飞 OA 提供的表单自定义 功能能够快速制作出内容丰富、格 式规范、美观的表单。
1 Chapter 2 Database Modeling Data Models Concept Model & Data Model Entity-Relationship diagrams.
力的合成 力的合成 一、力的合成 二、力的平行四边形 上一页下一页 目 录 退 出. 一、力的合成 O. O. 1. 合力与分力 我们常常用 一个力来代替几个力。如果这个 力单独作用在物体上的效果与原 来几个力共同作用在物体上的效 果完全一样,那么,这一个力就 叫做那几个力的合力,而那几个 力就是这个力的分力。
Databases 1 Fifth lecture. Entity-Relationship Model Diagrams Class hierarchies Weak entity sets From E/R diagrams to Relations 2.
Chapter 5 ER-to- Relational Mapping HUANG XUEHUA.
Instructor: Jinze Liu Fall Phases of Database Design u Conceptual design begins with the collection of requirements and results needed from the.
演示场景. 类图 配置 HibernateApplicationContext.xml hibernate.cfg.xml 创建数据库 – ooad/ooad 关于 Library/Project 模板.
李婵娟 二○一五年十一月. 什么是“走出去”企业? 开具中国税收居民身份证明 境外所得税收抵免情况及申请流程.
逻辑设计基础 1 第 7 章 多级与(或)非门电路 逻辑设计基础 多级门电路.
Entity-Relationship Model E/R Diagrams Converting E/R Diagrams to Relations.
1 Functional Dependencies 函数依赖 Meaning of FD’s Keys and Superkeys Functional Dependencies.
八. 真核生物的转录 ㈠ 特点 ① 转录单元为单顺反子( single cistron ),每 个蛋白质基因都有自身的启动子,从而造成在功能 上相关而又独立的基因之间具有更复杂的调控系统。 ② RNA 聚合酶的高度分工,由 3 种不同的酶催化转 录不同的 RNA 。 ③ 需要基本转录因子与转录调控因子的参与,这.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Functional Dependencies.
CS 405G: Introduction to Database Systems Relations.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 5 Introduction to a First Course in Database Systems.
§5.6 利用希尔伯特 (Hilbert) 变换 研究系统的约束特性 希尔伯特变换的引入 可实现系统的网络函数与希尔伯特变换.
进口食品标签中介服务平台介绍 上海顺益信息科技有限公司. 目录页 平台操作 平台定义 平台功能 进口食品标签中介服务平台介绍.
1 第三章 数列 数列的概念 考点 搜索 ●数列的概念 ●数列通项公式的求解方法 ●用函数的观点理解数列 高考 猜想 以递推数列、新情境下的 数列为载体, 重点考查数列的通 项及性质, 是近年来高考的热点, 也是考题难点之所在.
宿松县国有资金投资 建筑工程项目专项治理 自查自纠业务培训 宿松县国有资金投资建筑工程项目专项治理领导小组办公室 2015 年 8 月 3 日.
© D. Wong Ch. 3 (part 1)  Relational Model basics  From E/R diagram to Relations.
High-level Database Models Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
SME.USTB Human Factors 人机工程学 By Wei Dong Department of Industry Design, SME, USTB.
1 Chapter 3 The Relational Data Model. 2 Contents u3.1 Basics of the Relational Model u3.2 From E/R diagrams to Relational Designs u3.4 Functional Dependencies.
CS422 Principles of Database Systems From ER to Relations Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture notes.
Introduction to Database Systems, CS420
Entity-Relationship Model
CPSC-310 Database Systems
Transforming E/R to Relational Model.
The Relational Data Model
CS 405G Introduction to Database Systems
CS 405G: Introduction to Database Systems
Presentation transcript:

1 The Relational Data Model Tables Schemas Conversion from E/R to Relations

2 The things you should know… uThe basic principle of relational database is proposed by E.F.Codd in uThe first RDBMS production is System R uThe most popular RDBMS DB2, Oracle, Ingres, Sybase, Informix,SQL Server…

3 Basic of the Relational Model uThe relational model gives us a single way to represent data: as a two- dimensional table called a relation.

4 uAttributes ( 属性 ) wAttributes of a relation serve us as names for the columns of the relation. wUsually, the attributes describes the meaning of entries in the column below.

5 uSchemas (模式) wThe name of a relation and the set of attributes for a relation is called the schema for that relation. wWe show the schema for the relation with the relation name followed by a parenthesized list of its attributes.

6 uTuples (元组)  The rows of a relation, other than the header row containing the attributes, are called tuple. For example: wRelations, however, are sets of tuples, and it is impossible for a tuple to appear more than once in a given relation.

7 uDomains (域) wThe relational model requires that each component of each tuple be atomic; that is, it must be of some elementary type such as integers or string. wEach attributes of a relation has particular elementary type, thus domain is decided.

8 uEquivalent Representations of a Relation wThe attributes of the relation can be reordered without change the relation.

9 uRelation Instance (关系实例) wA relation about movies is not static; rather, relations change over time. wIt is not common for the schema of a relation to change. wWe shall call a set of tuples for a given relation an instance of that relation.

10 An Example of Relation Instance Relation: Person (Name, Address, Telephone) Relation Instance: NameAddressTelephone Bob123 Main St Bob128 Main St Pat123 Main St Harry456 Main St Sally456 Main St Sally456 Main St Pat12 State St

11 More … uRelation (Instance) = a set of tuples uDatabase = collection of relations uRelation schema = relation name + attributes wExample: Movies (title, year, length, fileType) uDatabase schema = a set of all relation schemas wMovies(Title, Year, Length, FileType) wStar(Name, Age) wStudio(StudioName, Addr)

12 Name Addr Tel N1 A1 T1 N2 A2 T2 N3 A3 T3 N4 T4 N5 T5 T6 T7 Name Addr Tel N1 A1 T1 N1 A1 T2 N1 A1 T3. N1 A1 T7 N1 A2 T1 N1 A3 T1 N2 A1 T1 Tuple Domain Component Attribute

13 From E/R Diagrams to Relations The problems in this step are how to transform the entity, relationship between entities into relational models,how to decide the attributes and the keys of these relational models.

14 uEntity set wOne entity is transformed to one relation, the attributes of the entity are the attributes of the relational schema, and the key of the entity is the key of the relational schema. From E/R Diagrams to Relations ( Cont. ) Entity set -> relation. Attributes -> attributes.

15 Entity Set -> Relation Relation: Stars(name, address) Stars name address

16 Relationship (1) 1:1 relationship can be transformed into one relation schema, the keys of the entities related to this relationship, and the attributes of this relationship all are transformed into attributes of the relation schema, the keys of each entity related to this relationship are the candidate key of the relation schema. Also, the relationship can be combined with the relation schema corresponding to one entity related to this relationship, in this case, the key of entity in the other end and the attribute of the relationship must be added into the relation; From E/R Diagrams to Relations ( Cont. )

17 (2) Relationship 1:n can be treated as in (2), except that if it is transformed into one independent relation schema, the key of it will be the key in end ‘n’. (3) Relationship m:n is transformed into one independent relation schema, the keys of every entities related to this relationship and the attributes of this relationship are all transformed into attributes of the relation schema, the key of the relation schema is the group of the keys of every entities related to this relationship. (4) Multi-relationship among three or more entities can be treated as in (3); (5) Relation schema with the same key ca be combined. From E/R Diagrams to Relations ( Cont. )

18 uRelationship -> Relation Owns (title, year, studioname) Stars-in (title, year, starName)

19 Combining Relations uOK to combine into one relation: 1.The relation for an entity-set E 2.The relations for many-one relationships of which E is the “many.”

20 Example Movies(title, year,length,filmType) and Owns (title, year, studioname) combine to Movies(title, year,length,filmType,studioname).

21 Risk with Many-Many Relationships uCombining Movies with Star would be a mistake. It leads to redundancy, as: Redundancy titleyearlengthfilm typestudioNamestarName Star Wars Mighty Ducks Wayne’s World color Fox Disney Paramount Carrie Fisher Mark Hamill Harrison Ford Emilio Estevez Dana Carvey Mike Meyers

22 E-R 图向关系模型的转换原则  一个实体转换为一个关系模式,实体的属性就 是关系的属性,实体的码就是关系的码  对实体间的联系  一个 1:1 联系可以转换为一个独立的关系模式,也可 以与任意对应的关系模式合并  一个 1:n 联系可以转换为一个独立的关系模式,也可 以与 n 端对应的关系模式合并  一个 m:n 联系转换为一个关系模式  三个或三个以上实体间的一个多元联系可以转换为 一个关系模式  具有相同码的关系模式可以合并 中文:

23 如公司部门管理系统的 E-R 图及其转换成的关系模式 部门项目 职工 电话 包括 承担 n 1 n1 办公室号,面积项目号,预算费 参与 m n 办公室 包含 1n 包括 n 1 部门号,预算费, 领导人职工号 电话号码,说明 职工号,姓名,办公电话 分担任务  部门 ( 部门号,部门预算费,领导人职工号 )  职工 ( 职工号,姓名,办公电话,部门号 )  办公室 ( 办公室号,面积,部门号 )  项目 ( 项目号,项目预算费,部门号 )  电话 ( 电话号码,说明,办公室号 )  项目承担情况 ( 职工号,项目号,分担任务 )

24 Handling Weak Entity Sets uRelation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own, nonkey attributes. uA supporting relationship is redundant and yields no relation (unless it has attributes).

25 Example LoginsHostsAt name Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName, hostName2) Must be the same billTo At becomes part of Logins location

26 Subclasses: Three Approaches 1.Object-oriented : One relation per subset of subclasses, with all relevant attributes. 2.Use nulls : One relation; entities have NULL in attributes that don’t belong to them. 3.E/R style : One relation for each subclass: wKey attribute(s). wAttributes of that subclass.

27 Example Beers Ales isa name manf color

28 Object-Oriented namemanf BudAnheuser-Busch Beers name manfcolor Summerbrew Pete’sdark Ales Good for queries like “find the color of ales made by Pete’s.”

29 E/R Style namemanf Bud Anheuser-Busch Summerbrew Pete’s Beers name color Summerbrew dark Ales Good for queries like “find all beers (including ales) made by Pete’s.”

30 Using Nulls namemanf color Bud Anheuser-Busch NULL Summerbrew Pete’s dark Beers Saves space unless there are lots of attributes that are usually NULL.

31 Exercise uRequired: Convert the E-R diagram you designed in last exercise into a relational database schema.