杨立伟教授台湾大学工管系.ppt

上传人:本田雅阁 文档编号:3172124 上传时间:2019-07-20 格式:PPT 页数:42 大小:1.20MB
返回 下载 相关 举报
杨立伟教授台湾大学工管系.ppt_第1页
第1页 / 共42页
杨立伟教授台湾大学工管系.ppt_第2页
第2页 / 共42页
杨立伟教授台湾大学工管系.ppt_第3页
第3页 / 共42页
杨立伟教授台湾大学工管系.ppt_第4页
第4页 / 共42页
杨立伟教授台湾大学工管系.ppt_第5页
第5页 / 共42页
点击查看更多>>
资源描述

《杨立伟教授台湾大学工管系.ppt》由会员分享,可在线阅读,更多相关《杨立伟教授台湾大学工管系.ppt(42页珍藏版)》请在三一文库上搜索。

1、楊立偉教授 台灣大學工管系,2014 Fall,1,Chapter 3: Modeling Data in the Organization,註 : 於11版為Chapter 2,2,Business Rules,Statements that define or constrain some aspect of the business 用來定義或限制 : Ex. 每人每學期修課總學分上限為30學分 Control/influence business behavior 控制或影響行為 Ex. 避免學生超修行為 Expressed in terms familiar to end users

2、 以使用者熟悉的語言來表達 Automated through DBMS software Ex. 修課系統應自動擋掉超修行為,3,A Good Business Rule Is:,Declarativewhat, not how 陳述清楚 Preciseclear, agreed-upon meaning 精確 Atomicone statement 不可分割 Consistentinternally and externally 一致 Expressiblestructured, natural language 可被結構化的口語表達 Distinctnon-redundant 非贅述的

3、Business-orientedunderstood by business people 可被該領域的人了解,4,A Good Data Name Is:,Related to business, not technical 非技術詞 Meaningful and self-documenting 看了就懂 Unique 獨一 Readable 可讀性高 Composed of words from an approved list 是可用列表中的語詞 Repeatable 適用多種狀況 Follows standard syntax 有固定命名方式,5,E-R Model Constru

4、cts,Entities: 個體 Entity instance person, place, object, event, concept (often corresponds to a row in a table) Entity Type collection of entities (often corresponds to a table) Relationships: 關係 Relationship instance link between entities (corresponds to primary key-foreign key equivalencies in rela

5、ted tables) Relationship type category of relationshiplink between entity types Attribute: 屬性 property or characteristic of an entity or relationship type (often corresponds to a field in a table),6,Sample E-R Diagram (Figure 3-1),0 or 1,1N,0N,1,7,Relationship degrees specify number of entity types

6、involved,Relationship cardinalities specify how many of each entity type is allowed,Basic E-R notation (Figure 3-2),8,What Should an Entity Be?,SHOULD BE: An object that will have many instances in the database An object that will be composed of multiple attributes An object that we are trying to mo

7、del SHOULD NOT BE: A user of the database system An output of the database system (e.g., a report),先找出 Entity,9,Inappropriate entities,Figure 3-4 Example of inappropriate entities,Appropriate entities,X 會計出納員 (這是操作的人),X 費用報告 (這是運算後的結果),10,Attributes,Attributeproperty or characteristic of an entity o

8、r relationship type Classifications of attributes: Required versus Optional Attributes 是否必填 Simple versus Composite Attribute 複合屬性 Ex. 姓名 vs 姓+名 Single-Valued versus Multivalued Attribute 是否有多值 Stored versus Derived Attributes 是否為衍生屬性 Ex. 出生年 vs 年齡 Identifier Attributes 是否可供識別用 Ex. 學號,Data Modeling

9、Concepts: Attributes,Attribute a descriptive property or characteristic of an entity. Synonyms include element, property, and field. Just as a physical student can have attributes, such as hair color, height, etc., data entity has data attributes Compound attribute an attribute that consists of othe

10、r attributes. Synonyms in different data modeling languages are numerous: concatenated attribute, composite attribute, and data structure. 例如: 姓名屬性可由姓+名所組成 右方紅框內即為複合屬性,Data Modeling Concepts: Data Type 資料型別 這個屬性可以裝哪種資料,Data type a property of an attribute that identifies what type of data can be sto

11、red in that attribute.,Data Modeling Concepts: Domains 資料範圍 這個屬性裝哪些值才是合法,Domain a property of an attribute that defines what values an attribute can legitimately take on.,Data Modeling Concepts: Default Value 預設值,Default value the value that will be recorded if a value is not specified by the user.,

12、15,Identifiers (Keys),Identifier (Key)an attribute (or combination of attributes) that uniquely identifies individual instances of an entity type Ex. 學號 or 系所+姓名 Simple versus Composite Identifier Candidate Identifier an attribute that could be a keysatisfies the requirements for being an identifier

13、,16,Characteristics of Identifiers,Will not change in value 不會更改 Will not be null 不會無值 No intelligent identifiers (e.g., containing locations or people that might change) 不要包含可能更改的欄位 Ex. 系所+姓名 Substitute new, simple keys for long, composite keys 簡短單一最好,17,Figure 3-7 A composite attribute,年資,技能,地址,18

14、,Figure 3-9 Simple and composite identifier attributes,ID欄位 (或稱 Key鍵值),19,Figure 3-19 Simple example of time-stamping,This attribute is both multivalued and composite,歷史價格 注意大括號與小括號,20,More on Relationships,Relationship Types vs. Relationship Instances The relationship type is modeled as lines betwe

15、en entity typesthe instance is between specific entity instances Relationships can have attributes These describe features pertaining to the association between the entities in the relationship Two entities can have more than one type of relationship between them (multiple relationships) Associative

16、 Entity combination of relationship and entity 特殊關係所轉換成的entity,21,Figure 3-10 Relationship types and instances,a) Relationship type,b) Relationship instances,22,Degree of Relationships,Degree of a relationship is the number of entity types that participate in it Unary Relationship A relationship bet

17、ween different instances of the same entity is called a recursive relationship Binary Relationship Ternary Relationship,23,Degree of relationships from Figure 3-2,Ex. 朋友關係,Ex. 修課關係,Ex. 工作分派關係,24,Cardinality of Relationships,One-to-One Each entity in the relationship will have exactly one related ent

18、ity One-to-Many An entity on one side of the relationship can have many related entities, but an entity on the other side will have a maximum of one related entity Many-to-Many Entities on both sides of the relationship can have many related entities on the other side,25,Cardinality Constraints,Card

19、inality Constraintsthe number of instances of one entity that can or must be associated with each instance of another entity Minimum Cardinality 最小值 If zero, then optional If one or more, then mandatory Maximum Cardinality 最大值 The maximum number,26,Figure 3-12 Examples of relationships of different

20、degrees a) Unary relationships,27,Figure 3-12 Examples of relationships of different degrees (cont.) b) Binary relationships,28,Figure 3-12 Examples of relationships of different degrees (cont.) c) Ternary relationship,廠商,零件,倉庫,供應出貨關係,29,Figure 3-17 Examples of cardinality constraints a) Mandatory c

21、ardinalities 必填,30,Figure 3-17 Examples of cardinality constraints (cont.) b) One optional, one mandatory,31,Figure 3-17 Examples of cardinality constraints (cont.) c) Optional cardinalities,32,Entities can be related to one another in more than one way,Figure 3-21 Examples of multiple relationships

22、 a) Employees and departments,33,Figure 3-21 Examples of multiple relationships (cont.) b) Professors and courses (fixed lower limit constraint),Here, min cardinality constraint is 2. At least two professors must be qualified to teach each course. Each professor must be qualified to teach at least o

23、ne course.,34,Figure 3-15a and 3-15b Multivalued attributes can be represented as relationships,simple,composite,35,Strong vs. Weak Entities, and Identifying Relationships,Strong entities exist independently of other types of entities has its own unique identifier identifier underlined with single l

24、ine Weak entity dependent on a strong entity (identifying owner)cannot exist on its own does not have a unique identifier (only a partial identifier) partial identifier underlined with double line entity box has double line Identifying relationship links strong entities to weak entities,36,Strong en

25、tity,Weak entity,Identifying relationship (Figure 3-5),扶養親屬,37,Associative Entities,An entityhas attributes A relationshiplinks entities together When should a relationship with attributes instead be an associative entity All relationships for the associative entity should be many The associative en

26、tity could have meaning independent of the other entities 有獨立意義時 The associative entity preferably has a unique identifier, and should also have other attributes 自己有獨立id時 The associative entity may participate in other relationships other than the entities of the associated relationship (理由類同下條) Ter

27、nary relationships should be converted to associative entities,38,Figure 3-11a A binary relationship with an attribute,Here, the date completed attribute pertains specifically to the employees completion of a courseit is an attribute of the relationship,39,Figure 3-11b An associative entity (CERTIFI

28、CATE),Associative entity is like a relationship with an attribute, but it is also considered to be an entity in its own right Note that the many-to-many cardinality between entities in Figure 3-11a has been replaced by two one-to-many relationships with the associative entity,轉成一張表,40,Figure 3-13c A

29、n associative entity bill of materials structure,This could just be a relationship with attributesits a judgment call,41,Figure 3-18 Ternary relationship as an associative entity,42,Microsoft Visio Notation for Pine Valley Furniture E-R diagram (Figure 3-22),Different modeling software tools may have different notation for the same constructs,圖例可能略有不同,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1