Download presentation
1
Module 2: Conceptual Data Modeling with ERD
Entities ERD Modeling Identify and Model Entities Define Relationships Entity Relationship Layout ERD Modeling Relationship and Frequencies Special Relationship Types Objectives At the end of this module, you will be able to: Identify entities. Determine entity relationships. Name the three types of relationships. Determine a relationship’s optionality and degree. Model entities and relationships. Create relationship grids.
2
Entities An entity, like a noun, is a person, place, thing, or event about which the system is to maintain, correlate, and display information. An entity must be within the scope of the system; not all nouns are entities. Entities versus Associated Information Entity = Table Entities versus Associated Information Entity (Table) Information (Attributes) ======= ==================== Course Course Name Course Section Course Start Time Student Student Name Address Phone What other attributes might be identified for the Student entity?
3
Instance of an Entity Instance of an Entity: An entity instance refers to one distinct entity occurrence. (= Record) Examples: Joe Smith, along with his address and so on, is an occurrence of STUDENT. Algebra 101 is an instance of COURSE. An instance is the same as a record (row) in a table (entity) in the relational database.
4
Instance of an Entity (continued)
Practice: Identify the entities in the following description by circling the nouns. Remember, entities must be within the scope of the system. “Buffalo Records and CDs has been in business for only three years and we have already expanded our business to five stores. We’ve decided it might be about time to get a computer to keep track of some of these things that we keep losing information on. For instance, just last week when we did our item inventory, I was sure we had a copy of that new Guns and Roses CD, but a customer came in just yesterday looking for it and it was nowhere to be found? Thought we better get a bit more organized. Anyway, we have 20 employees now. We need to keep track of their names, addresses, phone numbers, social security numbers, and birth dates. We like to send our employees birthday cards, or cards for other special occasions. Like Joe over there - his wife just had a baby yesterday.” Question: What are some examples of the entities defined above? Store Employee Merchandise (Item Inventory) Customer
5
Classifying Entities Entities are classified by three types:
Entities can tangible and intangible. Question: What are other examples of the above types of entities?
6
ERD Modeling Entity Relationship Attribute Domain
Modeling Conventions - Entities Entity Relationship Diagrams (ERDs) are part of the business model. The diagrams visually represent entities and the business relationships between them. Entity A thing of significance, real or imagined, about which information needs to be stored. Usually derived from nouns in the “interview” notes: Requirements Modeling (Analysis) – To identify what our client wants for the To-Be (future) system. Relationship Identifies how one entity relates to, or is associated with, another entity. Usually derived from verbs in the interview notes. Attribute Any single item of information that serves to qualify, identify, classify, or express the state of an entity. Domain A set of business validation rules, format constraints or other properties that apply to attributes. A domain may be a: List of values. Range of values. Attributes in the same domain are subject to a common set of validation checks.
7
Modeling Conventions - Entities
Entities have singular unique names. They are pictorially represented by a rounded box, as in the following: Employee Employee Customer Customer Order Order
8
Identifying and Modeling an Entity
Determine the significant nouns. Determine a logical name for the entity. Write a description for the entity. Interview end-users to determine the objects of significance about which they need to maintain and correlate information. Determining Entities Determine the nouns. Are they things of significance? Is there information of interest that needs to be maintained or correlated for the noun? Determine a logical name for the entity. Write a description for the entity. An example may be “A customer has significance as a person or company who purchases or orders goods.”
9
Defining a Relationship
Types of Relationships Naming Relationships Relationships Naming Syntax
10
Types of Relationships
A relationship is a two-directional, significant association between two entities, or an entity and itself Types of Relationships Pictorially represented by a line between two entities. Three types of relationships exist: One to One (1:1) One to Many (1:M) Many to Many (M:M) One to One Relationship: Boeing Commercial Aircraft Division Salesperson is assigned to one and only one customer (one airline company). Entity A: Customers (airline companies) Entity B: Salespersons Entity B Entity A An instance of Entity A relates to one and only one instance of Entity B. Entity B relates to one and only one instance of entity A.
11
Types of Relationships (continued)
One to Many (1:M) Entity A Entity B One to Many: One salesperson has several customers. Entity A: Customers Entity B: Salespersons An instance of Entity B relates to one or more instances of Entity A. An instance of Entity A relates to one and only one instance of Entity B.
12
Types of Relationships (continued)
Many to Many (M:M) Entity A Entity B Many to Many: Entity A: Students Entity B: Courses Useful Relationship Names The following is a partial list of some useful relationship names: about subject of allocated for used by applied to subject of assigned to performed by at location of based on basis for child of parent to classification for of covered by for defined by part of definition of description of for for shown on initiated by initiated for made up of for operated by operated for ordered by filled by owned by owner of part of composed of part of associated with required by performed on responsible for responsibility of site of in source of based on subject of applied to An instance of Entity A relates to one or more instance of Entity B. An instance of Entity B relates to one or more instance of Entity A.
13
Naming Relationships Each end of a relationship must have a name to describe the relationship, an optionality, and a degree. Appropriate naming helps to understand the relationship, exposing potential problems early on. for SALE ITEM SALE Useful Relationship Names The following is a partial list of some useful relationship names: about subject of allocated for used by applied to subject of assigned to performed by at location of based on basis for child of parent to classification for of covered by for defined by part of definition of description of for for shown on initiated by initiated for made up of for operated by operated for ordered by filled by owned by owner of part of composed of part of associated with required by performed on responsible for responsibility of site of in source of based on subject of applied to Made up of Each SALE must be made up of one or more SALE ITEMs. Each SALE ITEM must be for one and only SALE. Relationship Naming Syntax Each ENTITY A [must be/may be] relationship end name [one and only one/one or more] ENTITY B
14
Conditional Relationships
A relationship may not always exist. for Ticket Passenger Holder of Each Passenger may be the holder of one or more Tickets. Each Ticket must be for one and only one Passenger.
15
Conditional Relationships (continued)
Read the Relationship in Each Direction First read left to right: for Ticket Passenger Each Ticket must be for one and only one Passenger. Then read right to left: Ticket Passenger Holder of Each Passenger may be the holder of one or more Tickets.
16
Practice: Defining a Relationship
In this practice exercise, you will describe a relationship. Read and define the following relationships: Enrolled in Student Course Attended by “A student may be enrolled in one or many courses; a course may be attended by one or many students.” “A patient may receive one or more treatments; Each treatment must be for one and only one Patient.” Where a treatment is unique to each patient The relationship between “treatment” and “patient” can be also considered a M:M (many to many) relationship because a treatment (e.g. surgery) can be given for many patients. (Note: This argument was raised by a student, after I finished Module 2 on April 16, She will receive a big extra credit. (^_^) as a reward. I am very pleased to see many of you begin to understand the relational data modeling.) for Treatment Patient receive
17
*Entity Relationship Layout
Always draw crow’s-feet pointing up or to the left. Place larger, more dynamic entities toward the upper left of the diagram. Avoid crossed lines.
18
*ERD Modeling Relationships and Frequencies
(1:1) Rare (1:M) Very Rare (1:M) Common (1:M) Rare (1:M) Very Common (M:M) Common (M:M) Rare
19
Reading a Diagram Entity Relationship Diagram Sale Item Product Sale
In this practice exercise, you will read a diagram and describe the relationships. Read the following diagram and describe the relationships: Sale Item identifier of Part of Entity Relationship Diagram contained in made up of Product Part of Comprised of Managed by Sold by Sale Employee Initiated by Located in Manager of The initiator of The location for Located in Customer State Located of
20
*Special Relationship Types
Dependent Relationships Associative Relationships Intersection Entity
21
Dependent Relationships (1:M)
A One to Many relationship my be represented as 1:M or 1 to M and specifies one or more in one direction and only one in the other direction. 1:M relationships can be called “dependent,” “hierarchical,” or “parent/child.” Treatment for Patient receive 1:M relationships are very common. 1:M relationships that are mandatory in both directions are uncommon. Model multi-level hierarchical data as several 1:M relationships: City within Made up of Country within Made up of Continent
22
Associative Relationships (M:M)
A Many to Many, or M:M relationship indicates a degree of one or more in both directions. Student Enrolled in Course Attended by Each student may be enrolled in one or more courses. Each Course may be attended by one or more Students. Automobile Serviced by Mechanic services M:M relationships are very common. M:M relationships are usually optional in both directions. M:M relationships will be “resolved” by using intersection entities because relational models do not directly accommodate them.
23
Intersection Entity (Associative Entity)
Intersection (or Associative) Entities are created to decompose a M:M into two 1:M relationships, with the Intersection Entity being the “child” of both original “parent” entities. Service Serviced by Mechanic services Performed on receives Automobile
24
Review Entities ERD Modeling Identify and Model Entities
Define Relationships Entity Relationship Layout ERD Modeling Relationships and Frequencies Special Relationship Types 1. What three types of entities exist: 2. In what directions should crow’s feet always be drawn (ideally)? 3. What is the most common type of relationship? 4. What can 1:M relationships be called?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.