1 / 55

Database Systems: Design, Implementation, and Management Tenth Edition

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling. 4.1 The Entity Relationship Model (ERM). ER model forms the basis of an ER diagram ERD represents conceptual database as viewed by end user

watlington
Download Presentation

Database Systems: Design, Implementation, and Management Tenth Edition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database Systems: Design, Implementation, and ManagementTenth Edition Chapter 4 Entity Relationship (ER) Modeling

  2. 4.1 The Entity Relationship Model (ERM) • ER model forms the basis of an ER diagram • ERD represents conceptual database as viewed by end user • ERDs depict database’s main components: • Entities • Attributes • Relationships Database Systems, 10th Edition

  3. Entities • Refers to entity set and not to single entity occurrence • Corresponds to table and not to row in relational environment • In Chen and Crow’s Foot models, entity is represented by rectangle with entity’s name • The entity name, a noun, is written in capital letters Database Systems, 10th Edition

  4. Attributes • Characteristics of entities • Chen notation: attributes represented by ovals connected to entity rectangle with a line • Each oval contains the name of attribute it represents • Crow’s Foot notation: attributes written in attribute box below entity rectangle Database Systems, 10th Edition

  5. Database Systems, 10th Edition

  6. Attributes (cont’d.) • Required attribute: must have a value • Optional attribute: may be left empty • Domain: set of possible values for an attribute • For example, the domain for the grade point average (GPA) attribute is written (0,4) because the lowest possible GPA value is 0 and the highest possible value is 4. • Identifiers: one or more attributes that uniquely identify each entity instance • Composite identifier: primary key composed of more than one attribute Database Systems, 10th Edition

  7. Identifiers (primary keys) • Identifiers: one or more attributes that uniquely identify each entity instance • Composite identifier: primary key composed of more than one attribute Database Systems, 10th Edition

  8. Database Systems, 10th Edition

  9. Database Systems, 10th Edition

  10. Attributes (cont’d.) • Composite attribute can be subdivided • Simple attribute cannot be subdivided Database Systems, 10th Edition

  11. Attributes (cont’d.) • Single-value attribute can have only a single value • Multivalued attributes can have many values Database Systems, 10th Edition

  12. Attributes (cont’d.) Database Systems, 10th Edition

  13. Attributes (cont’d.) • M:N relationships and multivalued attributes should not be implemented • Create new entity composed of original multivalued attributes’ components Database Systems, 10th Edition

  14. Database Systems, 10th Edition

  15. Attributes (cont’d.) • A derived attribute is an attribute whose value is calculated (derived) from other attributes. • The derived attribute need not be physically stored within the database; instead, it can be derived by using an algorithm. Database Systems, 10th Edition

  16. For example, an employee’s age, EMP_AGE, may be found by computing the integer value of the difference between the current date and the EMP_DOB. If you use Microsoft Access, you would use the formula INT((DATE() – EMP_DOB)/365). Database Systems, 10th Edition

  17. Database Systems, 10th Edition

  18. Connectivity and Cardinality • Connectivity • Describes the relationship classification: 1:1 or 1:M or M:N • Cardinality • Expresses minimum and maximum number of entity occurrences associated with one occurrence of related entity • Established by very concise statements known as business rules Database Systems, 10th Edition

  19. Database Systems, 10th Edition

  20. Existence Dependence • Existence dependence • means that an instance of one entity cannot exist without the existence of some other related entity. • Ex: Transactions are existence dependent on accounts. • Existence independence • Entity can exist apart from one or more related entities Database Systems, 10th Edition

  21. Relationship Strength • Weak (non-identifying) relationships • Exists if PK of related entity does not contain PK component of parent entity • Strong (identifying) relationships • Exists when PK of related entity contains PK component of parent entity Database Systems, 10th Edition

  22. Database Systems, 10th Edition

  23. Database Systems, 10th Edition

  24. Database Systems, 10th Edition

  25. Database Systems, 10th Edition

  26. Weak Entities • Weak entity meets two conditions • Existence-dependent • Primary key partially or totally derived from parent entity in relationship • Database designer determines whether an entity is weak based on business rules Database Systems, 10th Edition

  27. Relationship Participation • Optional participation • One entity occurrence does not require corresponding entity occurrence in particular relationship • Mandatory participation • One entity occurrence requires corresponding entity occurrence in particular relationship Database Systems, 10th Edition

  28. Optional participation • For example, in the “COURSE generates CLASS” relationship, at least some courses do not generate a class. • In other words, an entity occurrence (row) in the COURSE table does not necessarily require the existence of a corresponding entity occurrence in the CLASS table. • Therefore, the CLASS entity is considered to be optional to the COURSE entity Database Systems, 10th Edition

  29. Database Systems, 10th Edition

  30. Distinction between mandatory or optional Database Systems, 10th Edition

  31. 1- Class is optional 2- Class is mandatory Database Systems, 10th Edition

  32. Relationship Degree • Indicates number of entities or participants associated with a relationship • Unary relationship • Association is maintained within single entity • Binary relationship • Two entities are associated • Ternary relationship • Three entities are associated Database Systems, 10th Edition

  33. Database Systems, 10th Edition

  34. Database Systems, 10th Edition

  35. Recursive Relationships • Relationship can exist between occurrences of the same entity set • Naturally found within unary relationship Database Systems, 10th Edition

  36. Recursive Relationships • 1:1 unary relationship may be expressed by “an EMPLOYEE may be married to one and only one other EMPLOYEE.” Database Systems, 10th Edition

  37. Recursive Relationships • the 1:M recursive relationship “EMPLOYEE manages EMPLOYEE,” is implemented in Figure 4.22. Database Systems, 10th Edition

  38. Associative (Composite) Entities • Also known as bridge entities • Used to implement M:N relationships. You should recall from Chapter 3 that the relational model generally requires the use of 1:M relationships. • IfM:N relationships are encountered, you must create a bridge between the entities that display such relationships. The associative entity is used to implement a M:N relationship between two or more entities. Database Systems, 10th Edition

  39. Associative (Composite) Entities • This associative entity (also known as a composite or bridge entity)composed of the primary keys of each of the entities to be connected. An example of such a bridge is shown in Figure 4.23. • May also contain additional attributes that play no role in connective process Database Systems, 10th Edition

  40. Database Systems, 10th Edition

  41. Database Systems, 10th Edition

  42. 4. 2 Developing an ER Diagram • Database design is an iterative process • Create detailed narrative of organization’s description of operations • Identify business rules based on description of operations • Identify main entities and relationships from business rules • Develop initial ERD • Identify attributes and primary keys that adequately describe entities • Revise and review ERD Database Systems, 10th Edition

  43. Database Systems, 10th Edition

  44. Database Systems, 10th Edition

  45. Database Systems, 10th Edition

  46. Database Systems, 10th Edition

  47. Database Systems, 10th Edition

  48. Database Systems, 10th Edition

  49. initially exist (at the start of the enrollment period) even though no students have enrolled in it, STUDENT is optional to CLASS in the M:N relationship. This M:N relationship must be divided into two 1:M relationships through the use of the ENROLL entity, shown in the ERD segment in Figure 4.31. Database Systems, 10th Edition

  50. Database Systems, 10th Edition

More Related