1 / 33

Overview of Entity‐Relationship Model

Entity‐Relationship Model is a detailed, logical representation of the data for an organization or for a business area. What are the entities and relationships in the enterprise?

riona
Download Presentation

Overview of Entity‐Relationship Model

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. Entity‐Relationship Model is a detailed, logical representation of the data for an organization or for a businessarea. • What are the entities and relationships in the enterprise? • What information about these entities and their relationships should we store in thedatabase? • What are the integrity constraints or business rules thatholds? • The model must be as ‘open’ as possible and not tied to any technology or to any particular businessmethodology. • Introduced in 1976 by PeterChen. Overview of Entity‐RelationshipModel ISE230

  2. The E‐R model is usually expressed as an E‐R diagram. • Widespread CASEtool‐support • No standard notation for E‐Rmodeling/diagram. • Chen, Martin, Crow Foot and many othernotations. • E‐R Model is the mainstream approach for data modeling. • Communication tool between variousstakeholders. Overview of Entity‐Relationship Model(2) ISE230

  3. Term – word or phrase with specificmeaning • Examples: course, rental car, flight,reservation • Fact – association between two or moreterms • ‘A course is a module of instruction in a particular subject area’ • ‘A customer may request a model of a car from a rental branch on a particulardate’ • A good data definitionis: • Related to business, not technical,characteristics • Meaningful andself‐documenting • Composed of words from an approvedlist. Data Definitions in DataModeling ISE230

  4. Entity: A person, place, object, event, or concept in the user environment about which the organization wishes to maintaindata. • More examples on page 93 and 94 of 8thEdition. • Entity Type (or Entity Set) – collection ofentities • Often corresponds to atable. • Entity instance – A single occurrence of an entitytype. • Often corresponds to a row in atable. Entities and EntitySets Player Match Team Ground ISE230

  5. SHOULDBE: • An object that will have many instances in thedatabase. • An object that will be composed of multiple characteristics/attributes. • SHOULD NOTBE: • A user of the database system. • An output of the database system (e.g., areport). • Rules (conventions) for namingentities. • Singular (e.g. Player) vs. Plural names (e.g.Players) What Should an EntityBe? ISE230

  6. Property or characteristic of an entityset. • An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entityset. • Examples: Player name, Career runs, Number of centuries scored,etc. • Domain: The set of permitted values for eachattribute. • Rules/Conventions for naming attributestoo. Attributes ISE230

  7. Simple vs. CompositeAttribute • Single‐Valued vs. Multi‐valuedAttribute • Stored vs. DerivedAttributes • IdentifierAttributes • Required vs. OptionalAttributes AttributeClasses ISE230 10

  8. An attribute broken into many parts: compound data values. CompositeAttributes ISE230

  9. Multiple data values for one attribute areallowed Multi‐valuedAttributes ISE230

  10. Value can be computed from otherattributes • Example: Age, given Date ofBirth • CareerRuns DerivedAttributes Centuries PlayerName Player Average ISE230

  11. Identifier (orKey)is an attribute (orcombinationof attributes) that uniquely identifies individual instances of an entitytype • Simple vs. CompositeIdentifier Identifiers (akaKeys) Date FlightNumber Destination FlightID Flight ISE230

  12. Will not change invalue • No intelligent/dynamic identifiers (e.g., containing locations or people that mightchange) • Example: Captain’s name as an identifier of the team (YYoounisElevenn)) • Will not benull/empty • It is recommended to substitute new, simple keys for long, compositekeys • Candidate Identifier is an attribute that could be akey • It satisfies the requirements for being anidentifier Characteristics ofIdentifiers ISE230

  13. Links/Association between entities – modeled as connectinglines. • Relationship Types: Modeled as association between entitytypes Relationships • Relationship Instances: Links between specific entity instances • PlayerTeam Inzimam‐ul‐Haq BrianLara RanaNaveed Pakistan LahoreBadshah WestIndies SachinTendulkar India ISE230

  14. One‐to‐One • Each entity in the relationship will have exactly one related entity • 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 relatedentity • Many‐to‐Many • Entities on both sides of the relationship can have many related entities on the otherside Cardinality ofRelationships ISE230

  15. Cardinality Constraints ‐ the number of instances of one entity that can or must be associated with each instance of anotherentity • MinimumCardinality • If zero, then relationship isoptional • If one or more, then mandatory (MUSThold) • MaximumCardinality • The maximum number of entity instances that could be association with the target entity in therelationship. CardinalityConstraints ISE230

  16. One entity instance associated with only (maximum) one target entity instance One‐to‐OneRelationship A manager isassociated One team is managedby with only one team at most, or there is no manager. only one manager atmost or not managed atall. ISE230 20

  17. Optionalcardinalities One‐to‐One Relationship(2) A person is married to at most oneother person, or may not be married atall ISE230

  18. Many entity instances associated with either optionally or mandatory many target entityinstances Many‐to‐ManyRelationship Many teams can have same or many players. One or more players are associated with none or moreteams. ISE230

  19. One entity instance associated with optionally or mandatory many target entityinstances. One‐to‐ManyRelationship ISE230

  20. Entities can be related to one another in more than one way • Employees anddepartments Examples of multiplerelationships ISE230

  21. Examples of multiplerelationships • Professors and courses (fixed upper limitconstraint) ISE230

  22. Degree of a relationship is the number of entity types that participate init • UnaryRelationship • BinaryRelationship • TernaryRelationship Degree ofRelationships ISE230

  23. Degree of relationships:Notations Entities of two different types related to eachother One entity related to another of the same entitytype Entities ofthree different types related to each other ISE230 27

  24. Degree of relationships:Examples • a) Unaryrelationships ISE230

  25. Degree of relationships:Examples • b) Binaryrelationships ISE230

  26. c) Ternaryrelationship Degree of relationships:Examples Note: a relationship can have attributes of itsown ISE230 30

  27. Binary Relationships withAttributes Here, the date completed attribute pertains specifically to the employee’s completion of a course…it is an attribute of therelationship ISE230 31

  28. An associative entity(CERTIFICATE) Associative entity is like a relationship with an attribute, but it is also considered to be an entity in its ownright. Note that the many‐to‐many cardinality between entities in previous figure has been replaced by two one‐to‐many relationships with the associativeentity. ISE230

  29. Ternary relationship as an associativeentity ISE230

  30. When should a relationship with attributes instead be an associativeentity? • All relationships for the associative entity should bemany • The associative entity could have meaning independent of the otherentities • The associative entity preferably has a unique identifier, and should also have otherattributes • The associative entity may participate in other relationships other than the entities of the associatedrelationship • Ternary relationships should be converted to associativeentities AssociativeEntities ISE230

  31. Multi‐valued Attributes vs.Relationships simple composite ISE230

  32. Strong Entity Type: One that exists independently of other entitytypes. • Strong entity instances always have a uniqueidentifier • Identifier is underlined withsingle‐line • Examples: Student, Employee,Course • Weak Entity Type: One whose existence depends on a strong entity (called Identifying Owner). • It only has a partialidentifier • Partial identifier is underlined withdouble‐line • Entity box has doubleline • Example: Employee versusEmployeeCredentials Strong vs. WeakEntities ISE230

  33. Summary • Basic business rules are data names anddefinitions • Data modeling notations frequently used today is the entity‐relationship datamodel. • E‐R model constructs: entities, entity types, relationships, relationship types, attributes, identifiers, cardinality constraints. • EssentialReading • Modern Database Management (8th Ed.), Chapter3 • What isNext? • More on ER and Enhanced E‐RModel Conclusion ISE230

More Related