Download presentation
Presentation is loading. Please wait.
Published byMonica Lambert Modified over 8 years ago
1
ENTITY RELATIONSHIP DIAGRAM
2
Objectives Define terms related to entity relationship modeling, including entity, entity instances, attribute, relationship and cardinality and primary key Describe the entity modeling process Discuss how to draw an ERD Describe how to recognize entities, attributes, relationships and cardinalities
3
Database Model A database can be modeled as: A collection of entities Relationship among attributes Database systems are often modeled using an ERD as the “blueprint” from which actual data is stored - the output of the design phase
4
ERD ER model allows us to sketch database designs ERD is a graphical tool for modeling data ERD is widely used in database design ERD is a graphical representation of the logical structure of a database ERD is a model that identifies the concepts or entities that exist in a system and the relationship between those entities
5
Purpose of ERD An ERD serves several purposes The database analyst/designer gains a better understanding of the information to be contained in the database through the process of constructing the ERD The ERD serves as documentation tool Finally, the ERD is used to communicate the logical structure of the database to users. In particular, the ERD effectively communicates the logic of the database to users
6
Components of an ERD An ERD typically consists of four different graphical components: Entity Relationship Cardinality Attribute
7
Classification of Relationship Optional Relationship An employee may or may not be assigned to a Department A patient may or may not be assigned to a bed Mandatory Relationship Every course must be taught by at least one teacher Every mother have at least a child
8
Cardinality Constraints Express the number of entities to which another entity can be associated via a relationship set. Cardinality constraints – the number of instances of one entity that can be associated with each instance of another entity. Minimal cardinality if zero, then optional If one or more, then mandatory Maximum cardinality maximum number
9
Cardinality constraints Cont’d… For a binary relationship set the mapping – cardinality must be one of the following types: One to one A Manager Heads one Department and Vice Versa One to many (or many to one) An Employee Works in one Department or One Department has many Employees Many to many A Teacher Teaches many students and A student is taught by many Teachers
10
Cardinality Constraints Cont’d… Mandatory one Mandatory many Optional one Optional many
11
Cardinality Constraint Example In our model, we wish to indicate that each school may enroll many students, or may not enroll any students at all. We wish to indicate that each student attends exactly one school. The following example indicates this optionality and cardinality :
12
Example Cont’d Each school enrolls at least zero and at most many students STUDENT SCHOOL
13
General steps to create an ERD Identify the entity Identify the entities attributes Identify the primary keys Identify the relationships between entities Identify the cardinality constraint Draw an ERD Check the ERD
14
Steps in building an ERD Model Entities and Attributes Choose Primary Keys Model Relationships Determine Cardinalities Check the model
15
Developing an ERD The process has ten steps 1. Identify entities 2. Find relationships 3. Draw a rough ERD 4. Fill in cardinality 5. Define primary keys 6. Draw key-based ERD 7. Identify attributes 8. Map attributes 9. Draw fully attributed ERD 10. Check Results
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.