Download presentation
Presentation is loading. Please wait.
1
Requirements Become the E-R Data Model
After the requirements have been gathered, they are transformed into an Entity Relationship (E-R) Data Model. The most important elements of E-R Models are: Entities Attributes Identifiers Relationships KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
2
Entity Class versus Entity Instance
An entity class is a description of the structure and format of the occurrences of the entity. An entity instance is a specific occurrence of an entity within an entity class. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
3
Entity Class and Entity Instance
Figure 4-2: The ITEM Entity and Two Entity Instances KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
4
Attributes Entities have attributes that describe the entity’s characteristics: ProjectName StartDate ProjectType ProjectDescription Attributes have a data type and properties. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
5
Identifiers Entity instances have identifiers.
An identifier will identify a particular instance in the entity class: SocialSecurityNumber StudentID EmployeeID KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
6
Identifier Types Uniqueness Composite
Identifiers may be unique or nonunique. If the identifier is unique, the data value for the identifier must be unique for all instances. Composite A composite identifier consists of two or more attributes. E.g., OrderNumber & LineItemNumber are both required. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
7
Levels of Entity Attribute Display
Figure 4-3: Levels of Entity Attribute Display KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
8
Relationships Entities can be associated with one another in relationships. Relationship degree defines the number of entity classes participating in the relationship: Degree 2 is a binary relationship. Degree 3 is a ternary relationship. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
9
Degree 2 Relationship: Binary
Figure 4-4: Example Relationships KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
10
Degree 3 Relationship: Ternary
Figure 4-4: Example Relationships KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
11
One-to-One Binary Relationship
A single entity instance in one entity class is related to a single entity instance in another entity class. An employee may have no more than one locker; and A locker may only be accessible by one employee (a) One-to-One Relationship Figure 4-5: Three Types of Binary Relationships KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
12
One-to-Many Binary Relationship
1:N (one-to-many) A single entity instance in one entity class is related to many entity instances in another entity class. A quotation is associated with only one item; and An item may have several quotations (b) One-to-Many Relationship Figure 4-4: Three Types of Binary Relationships KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
13
Many-to-Many Binary Relationship
N:M (many-to-many) Many entity instances in one entity class is related to many entity instances in another entity class: a supplier may supply several items; and a particular item may be supplied by several suppliers. (c) Many-to-Many Relationship Figure 4-5: Three Types of Binary Relationships KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
14
Maximum Cardinality Relationships are named and classified by their cardinality, which is a word that means count. Each of the three types of binary relationships shown above have different maximum cardinalities. Maximum cardinality is the maximum number of entity instances that may participate in a relationship instance—one, many, or some other fixed number. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
15
Minimum Cardinality Minimum cardinality is the minimum number of entity instances that must participate in a relationship instance. These values typically assume a value of zero (optional) or one (mandatory). KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
16
Cardinality Example Maximum cardinality is many for both ITEM and SUPPLIER. Minimum cardinality is zero (optional) for ITEM and one (mandatory) SUPPLIER. A SUPPLIER does not have to supply an ITEM. An ITEM must have a SUPPLIER. Figure 4-6: A Relationship with Minimum Cardinalities KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
17
Entity-Relationship Diagrams
The diagrams in previous slides are called entity-relationship diagrams. Entity classes are shown by rectangles. Relationships are shown by diamonds. The maximum cardinality of the relationship is shown inside the diamond. The minimum cardinality is shown by the oval or hash mark next to the entity. The name of the entity is shown inside the rectangle. The name of the relationship is shown near the diamond. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
18
HAS-A Relationships The relationships in the previous slides are called HAS-A relationships. The term is used because each entity instance has a relationship to a second entity instance: An employee has a badge. A badge has an employee. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
19
Types of Entity-Relationship Diagrams
Information Engineering (IE) [James Martin 1990]—Uses “crow’s feet” to show the many sides of a relationship, and it is sometimes called the crow’s foot model. Integrated Definition 1, Extended 3 (IDEF1X) is a version of the E-R model that is a national standard. Unified Modeling Language (UML) is a set of structures and techniques for modeling and designing object-oriented programs (OOP) and applications KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
20
Crow’s Foot Example: One-to-Many Relationship
Figure 4-7: Two Versions of a 1:N Relationship KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
21
Crow’s Foot Symbols Figure 4-8: Crow’s Foot Notation
KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
22
Crow’s Foot Example: Many-to-Many Relationship
Figure 4-9: Two Versions of an N:M Relationship KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
23
Weak Entity A weak entity is an entity that cannot exist in the database without the existence of another entity. Any entity that is not a weak entity is called a strong entity. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
24
ID-Dependent Weak Entities
An ID-Dependent weak entity is a weak entity that cannot exist without its parent entity. An ID-dependent weak entity has a composite identifier. The first part of the identifier is the identifier for the strong entity. The second part of the identifier is the identifier for the weak entity itself. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
25
ID-Dependent Weak Entity Examples
Figure 4-10: Example ID-Dependent Entities KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
26
Weak Entity Relationships
The relationship between a strong and weak entity is termed an identifying relationship if the weak entity is ID-dependent. Represented by a solid line The relationship between a strong and weak entity is termed a nonidentifying relationship if the weak entity is non-ID-dependent. Represented by a dashed line Also used between strong entities KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
27
Weak Entity Identifier: Non-ID-dependent
All ID-dependent entities are weak entities, but there are other entities that are weak but not ID-dependent. A non-ID-dependent weak entity may have a single or composite identifier, but the identifier of the parent entity will be a foreign key. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
28
Non-ID-Dependent Weak Entity Examples
Figure 4-11: Weak Entity Examples KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
29
Strong and Weak Entity Examples
Figure 4-12: Examples of Required Entities KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
30
Associative Entities An associative entity (also called an association entity) is used when there are attributes that are associated with the relationship between two entities rather than with either of the two entities themselves. A new entity is then created to: Link the two original entities Hold the attributes KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
31
Associative Entities (Cont’d)
Figure 4-13: The Associative Entity KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
32
Subtype Entities A subtype entity is a special case of another entity called supertype. An attribute of the supertype may be included that indicates which of the subtypes is appropriate for a given instance; this attribute is called a discriminator. Subtypes can be exclusive or inclusive. If exclusive, the supertype relates to at most one subtype. If inclusive, the supertype can relate to one or more subtypes. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
33
Subtype Entity Identifiers
The relationships that connect supertypes and subtypes are called IS-A relationships because a subtype is the same entity as the supertype. The identifier of a supertype and all of its subtypes is the same attribute. KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
34
Subtype Entity Examples
Figure 4-14: Example Subtype Entities KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
35
Recursive Relationships
It is possible for an entity to have a relationship to itself—this is called a recursive relationship. Figure 4-15: Example Recursive Relationship KROENKE and AUER - DATABASE CONCEPTS (7th Edition) Copyright © 2015 Pearson Education, Inc. Publishing as Prentice Hall
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.