Lecture 6 - Entity Relationship Modeling
Lecture 6 - Entity Relationship Modeling
(ERD)
FACULTY OF CS & IT
UNIVERSITY OF GUJRAT
Data Modeling
A detailed model that captures overall
structure of organizational data while
being independent of any
implementation considerations
Typically data modelling is carried out
parallel with other requirements
analysis and structuring steps during
the systems analysis phase.
Following this, the data model
supporting the scope and requirements
of the proposed system is developed.
2
Entity Relationship Diagram
Model: A Data Modeling
Approach.
Proposed by Peter Chen in 1976
Entity Relationship Diagram is a form of data
modelling
A logical representation of the data of an
organization or business area in graphical
form
Data modelling involves examining the data
objects in a system and identifying the
relationship between these objects
Top-down approach to database design
The primary purpose of an ERD is to
document the logical structure of a database
3
Why ERD ?
Conceptual design: (ER Model is
used at this stage.)
◦ What are the entities and relationships
in the enterprise?
◦ What information about these entities and
relationships should we store in the
database?
◦ What are the integrity constraints or
business rules that hold?
◦ A database `schema’ in the ER Model can
be represented pictorially (ER diagrams).
◦ An ER diagram can be mapped into a
relational schema.
4
Basic Symbols
Components Symbol
Name
Entity
Department
Attribute
Staff No.
Relationship
employs
5
An Entity
An entity is a thing of interest to a
system about which information is kept
6
Choosing Entities
Example
◦ A sale always starts with a customer
receiving an estimate. The estimate
then becomes an order. An order can
be for one or more stock items. Each
stock item belongs to a certain stock
category (e.g. taps, sinks, cupboards
etc.)
7
An Attribute
An attribute is an item of data
held about an entity
In computer systems an attribute
is a field of information
Example : Sales System
◦ Entity : Customer
◦ Attributes : Customer Name,
Customer Address, Customer Phone
Number
8
For Example
Ina Sales System, customer
name and address are
attributes of the entity
customer.
10
Service Center System
Data is used to:
◦ Assign employee to job
◦ Determine availability
Data to be captured in database:
◦ Employee data
◦ Job data
◦ Customer data
11
ERD - Service Center System
Employee Customer
assigned to Related to
Job
Service Center System
◦ Employee
Attributes: EmpID, Name, Address,
Phone Number, Available Hours,
JobNo
◦ Job
Attributes: JobNo, JobDate, JobTime,
EmpID
◦ Customer
Attributes: CusNo, Name, Address,
Phone Number, JobNo
13
Entity Instance
An entity instance is a single
occurrence of an entity type.
An entity type is described just once
in a data model while many instances
of that data type may be represented
by data stored in the system.
◦ There is one EMPLOYEE entity type in
most organisations but there may be
hundred or thousands of instances of this
entity type in the company.
Example
◦ A sale always starts with a customer
receiving an estimate.The estimate
then becomes an order. An order can
be for one or more stock items. Each
stock item belongs to a certain stock
category (e.g. taps, sinks, cupboards
etc.)
From the narrative we can
deduce
◦ An Estimate becomes an Order
◦ An Estimate is issued to a particular
Customer
◦ An Estimate refers to a Stock Item(s)
◦ An Order is placed by the Customer
◦ An Order refers to a Stock Item(s)
◦ A Stock Item refers to a particular
Stock Category
Order System
Order Refers to
Places
Becomes
Stock Item
Issued to Refers to
Customer Estimate
Refers to
Stock
Category
Entity Primary Key Other Attributes
18