Presentation is loading. Please wait.

Presentation is loading. Please wait.

1. 2 Data Modeling 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R.

Similar presentations


Presentation on theme: "1. 2 Data Modeling 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R."— Presentation transcript:

1 1

2 2 Data Modeling

3 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R Model Semantic Object Model Relational Model Page 47

4 4 Entity Relationship Data Model

5 5 Entity-Relationship Data Model Explicitly represents entities and their relationships Implementation independent For use at the conceptual and external levels Peter Pin-San Chen, The entity-relationship model---toward a unified view of data. ACM Transactions on Database Systems, Vol.1, No. 1, March 1976 - portal.acm.orgThe entity-relationship model---toward a unified view of data

6 6 A picture with Peter Chen, the founder of E-R model

7 7 Entity-Relationship Data Model Entity A thing, event, or person in the organization's environment about which someone wants to collect data Attribute Characteristic or property of an entity Relationship Association between entities Composite entity (Associative entity) Represents both an entity and relationship Has its own properties

8 8 Components of E-R Model Entity Relationship Composite entity Attribute

9 9 An E-R Model for Student Registration System Entities CourseInstructor Student

10 Course Enrollment 10 An E-R Model for Student Registration System CourseInstructor Student Advises Teaches N M M 1 1 M Relationships Many-to-many One-to-many

11 11 An E-R Model for Student Registration System Composite Entity CourseInstructor Student Advises Teaches M M 1 1 M M 1 1 Class Enrollment

12 12 An E-R Model for Student Registration System Course Number Description Instructor ID Name Rank Room Course Number Grade Student Number Student Number Major Student Name Attributes CourseInstructor Student Advises Teaches M M 1 1 M M 1 1 Class Enrollment

13 Entities “something that users track” Page 49 Figure 3-1 © 2000 Prentice Hall

14 14 Attributes (properties) “describe the entity’s characteristics” Entity:Employee Attributes:EmployeeName, Extension, DateOfHire, JobSkillCode Attribute type Key attribute or identifier (i.e. employee number) Single value attribute (i.e. spouse) Multivalued attribute (i.e. children) Derived attribute (i.e. tax payment) Page 50

15 15 More about Entities Existence Dependency The existence of one entity depends on the existence of one or more other entities Fundamental entity vs. Attributive entity or Weak entity A weak entity is one that is existence-dependent and has a primary key that is partially or totally derived from the parent entity in the relationship. Entity Supertypes and Subtypes Exclusive (disjoint) and Inclusive (overlapping) Covering and non-covering

16 Subtype Entities “an entity that contains option sets of attributes” Page 56 Figure 3-10b © 2000 Prentice Hall

17 17 Relationships A relationship is an association between entities. A unary relationship exists when an association is maintained within a single entity. (Recursive relationship) A binary relationship exists when two entities are associated. (Most common) A ternary relationship exists when three entities are associated. (e.g. real estate sales: buyer, seller, and property)

18 18 Classroom Assignment Course Time Slots Classroom Assignment 1 M 1 1M M Convert a ternary relationship to three binary relationships

19 Relationships “associations between entities” Page 51 Figure 3-3 © 2000 Prentice Hall

20 20 Connectivity and Cardinality The term connectivity is used to describe the relationship classification (e.g., one-to-one, one-to-many, and many-to-many). Cardinality expresses the specific number of entity occurrences associated with one occurrence of the related entity. Relational Participation: Optional, Mandatory The actual number of associated entities is usually a function of an organization’s policy.

21 21 Connectivity and Cardinality Professor teaches Course Connectivity 1 M (0,3) (1,1) Mandatory entity Optional entity Cardinality

22 22 Building E-R Model Understand business rules and assumptions Identify entities Identify relationships Identify attributes Check and improve E-R model Convert E-R model to relational tables

23 Business rules A business rule is a statement that defines or constrains some aspect of the business. Business rules and policies govern creating, updating, and removing data in an information processing and storage system. 23

24 Example of business rules A student can take up to five courses each term Each course will be taught by only one teacher A customer must use valid credit card to make online payment A flower order can deliver to anywhere in North America but only one location 24

25 Business rules As a database analyst, you need to: Identify and understand those rules that govern data Represent those rules so that they can be unambiguously understood Implement those rules in database technology 25

26 26 Sales Order Form

27 27 An E-R Model for Order Processing: Product Number Description Customer Name Address Unit price Quantity Order Number Date S Name S ID Orders Total

28 28 An E-R Model for Order Processing: Entities Products Customer Orders Salesman

29 29 An E-R Model for Order Processing: Relationships Products Customer Orders 1 M M 1 1 Salesman M OrderLine PreparedPlaced M 1

30 30 An E-R Model for Order Processing: Attributes Product Number Description Customer Name Address Unit price Product Number Quantity Order Number Order Number Date Customer Name S NameS ID Products Customer Orders 1 M M 1 1 Salesman M OrderLine PreparedPlaced M 1

31 31 Crow's Foot Notation of E-R Diagram with Attributes Shown

32 Cardinality Symbols of Relationships for ERD

33 33 Check and improve E-R model Convert a multivalued attribute into an attribute entity or weak entity Introduce composite entity to convert a m:n relation into two 1:m relations. Introduce a composite key

34 34 Check and improve E-R model Each entity must have a key (simple or composite) Make each attribute associate with only one entity unless it is a foreign key Make each entity represent a simple object or concept Divide complex entity into several related simple entities

35 35 Example:A Construction Company A manager may manage many projects. Each project requires the services of many employees. An employee may be assigned to several different projects. Some employees are not assigned to a project and perform duties not specifically related to a project. Some employees are part of a labor pool, to be shared by all project teams. Each employee has a (single) primary job classification. This job classification determines the hourly billing rate. Many employees can have the same job classification.

36 36 A E-R Model for A Construction Company ProjectEmployee Job class Assignment

37 37 A E-R Model for A Construction Company ManagerWorker Subclass ProjectEmployee Job class Assignment

38 38 A E-R Model for A Construction Company ProjectEmployee Job class 1 M M M 1 1 M Assignment Manages Has 1

39 39 A E-R Model for A Construction Company Project Number Project name Job Code Job Description Hour Rate Manager ID Project Number Hours Employee Number Employee Number Employee Name Assignment Number Hire Date ProjectEmployee Job class 1 M M M 1 1 M Assignment Manages Has 1

40 40 The Semantic Object Model

41 Semantic Object Model E. F. Codd, “Extending the Relational Model to Capture More Meaning,” ACM Transactions on Database Systems, Dec. 1976, pp. 397-424. Micheal Hammer and Dennis McLeod, “Database Description with SDM: A Semantic Database Model,” ACM Transactions on Database Systems, Setp. 1981, pp 351-386. 41

42 42 Semantic Objects “a named collection of attributes that sufficiently describes a distinct entity” Student Customer Employee Page 74

43 43 Attributes “ define the characteristics of semantic objects” Page 75 Figure 4-2a © 2000 Prentice Hall

44 44 Attribute Cardinality “indicates the minimum or maximum number of instances of the attribute that must exist in order for the object to be valid” Page 76 Figure 4-2b © 2000 Prentice Hall

45 45 Object Instances “ the occurrence of a particular semantic object” Page 77 Figure 4-3 © 2000 Prentice Hall

46 46 Object Identifier “one or more object attributes that the users employ to identify object instances” Example: CustomerID for Customer Page 78

47 47 Domain “a description of an attribute’s possible values” Page 78

48 48 Semantic Object View “ the portion of an object that is visible to a particular application; view” Page 79 Figure 4-4 © 2000 Prentice Hall

49 49 Highline University Administration Database Objects: College Department Professor Student Page 80

50 50 Semantic Object Diagrams Page 85 Figure 4-13 (1) © 2000 Prentice Hall

51 51 Semantic Object Diagrams Page 85 Figure 4-13 (2) © 2000 Prentice Hall

52 52 Semantic Object Diagrams Page 85 Figure 4-13 (3) © 2000 Prentice Hall

53 53 Semantic Object Diagrams Page 85 Figure 4-13 (4) © 2000 Prentice Hall

54 54 Sales Order Form

55 55 Semantic vs. E-R Model Page 105 Figure 4-34 © 2000 Prentice Hall

56 56 Semantic vs. E-R Model Page 105 Figure 4-33 © 2000 Prentice Hall


Download ppt "1. 2 Data Modeling 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R."

Similar presentations


Ads by Google