Download presentation
Presentation is loading. Please wait.
1
Data Modeling Using the ERD
Data Base 1 Data Modeling Using the ERD
2
E-R Model Introduction
There are different methods of data modeling, but the most widely used is the Entity-Relationship (ER) model. ER-Model can simply be stated as data model of the real world as entities and relationships. A basic component of the model is the Entity-Relationship diagram which is used to visually represent data objects.
3
To make ERD we need to make the following:
Step1: What are entities? (Tables) Step 2:What attributes includes in each table Step 3:What the primary key attribute in each table Step 4: What are relations between tables Step 5: Show the degree of participation for each table in relation
4
Summary of notation for ER diagrams
5
Representation in ER-Model
Entities Relationships Attributes Connectivity and Cardinality ER Notation
6
Entities Entities are the prime data objects about which information is to be collected. Entities are usually recognizable concepts, either concrete or abstract, such as person, places, things, or events which have relevance to the database. Examples - Employees and Customers
7
Relationships A Relationship represents an association between two or more entities. Example - Employees are assigned projects.
8
Attributes Attributes describe the entity or relationship of which they are associated. Example - Troy Griffin (employee’s name)
9
Connectivity and Cardinality
The connectivity of a relationship describes the mapping of associated entity instances in the relationship. The cardinality of a relationship is the actual number of related occurrences for each of the two entities. There are three basic types of connectivity: 1. A one-to-one relationship. 2. A one-to-many relationship. 3. A many-to-many relationship.
10
Connectivity and Cardinality
A one-to-one relationship which is when at most one instance of an entity A is associated with one instance of entity B.
11
Connectivity and Cardinality
A one-to-many relationship which is when for one instance of entity A, there are zero, one, or many instances of entity B, but for one instance of entity B, there is only one instance of entity A.
12
Connectivity and Cardinality
A many-to-many relationship which is when for one instance of entity A, there are zero, one, or many instances of entity B and for one instance of entity B there are zero, one, or many instances of entity A.
13
ER Notation There is no standard for representing data objects in ER diagrams. Each modeling style uses its own notation. All notational styles represent entities as rectangular boxes and relationships as lines connecting boxes. The standard given below is widely used: Attributes - Ellipses Relationship Sets - Diamonds Cardinalities – An arrow or a 1 pointing where one entity can be mapped
14
E-R Constraints
15
What are constraints? A constraint is assertion about a database that must be true at all times. It is part of database schema. Constraints play an important role in determining the best database design for an enterprise.
16
Why are constraints important?
It gives more semantics to the data Allow to refer to entities eg using keys Enables efficient storage, lookup etc.
17
Types of constraints Participation constraint - If all entities in an entity set must participate in a relation in the relationship set, a thick line is drawn. Two types Total – all entities of the entity set should participate in a relation in the relationship set. With total participation Eg. every loan has to be associated with a customer Partial – not all entities of the relation has to participate in a relation in the relationship set. Eg. Not every customer should be associated with a loan. Customer Loan Borrows
18
Read this example In DB for student registration we would like to keep data about students, courses, sections within courses and students' grades. A course may include several sections. Each one may be taught by different teacher. A student may register in a course and be assigned to a particular section within this course
19
Model this problem using the ER approach
Data kept about each student include :name, address, telephone numbers, ID#, gender, and birth date. For a course we would like to keep data concerning course-Id, course title, max. grade and number of lectures given/week. Section's data include Section#, room number where lectures are given, teacher's name. Section numbers are always 1, 2, ..etc. for each course. The DB should keep the date when the student registered in the course, his final grade Model this problem using the ER approach
20
Step 1: The first step to extract the entities or tables form the last case as the following Course Student Teacher Section
21
Step 2 To extract the attributes inside in each Tables Note the types of attributes as discussed before (Simple, composite, Multivalve, derived,Key)
22
Step 3 Determine a primary key attribute for each table
The primary attribute is the one who are unique attribute and not allowed to be null value
23
Step 4 Read the case again and try to extract the relations between tables
24
Step 5 Take each relation in ERD and specify the type of participation for each table If it is total participation or partial participation
25
Special cases
26
A Ternary Relationship
SID JID Quantity supply supplier project part PID
27
Recursive Relationship type: Conversion (1:M)
FN LN 1:1 EMPLOYEE SUPERVISES 0:N SS
28
Binary versus non-binary relationship
customer vehicle owns fixes mechanic parts
29
ER Advantages Exceptional conceptual simplicity Visual representation
Effective communication tool Integrated with the relational data model
30
ER Disadvantages Limited constraint representation
Limited relationship representation No data manipulation language Loss of information content
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.