Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Er Diagrams

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

ENTITY-

RELATIONSHIP
DIAGRAMS
Entity-Relationship Diagrams
 An ERD is a graphical model of the
information system that depicts the
relationships among system entities.
 An entity is a place thing or event for which
data is collected and maintained. For
example, sales region, products or orders.
ERD vs. DFD
 Whereas an ERD shows the logical
relationships among system entities, a DFD
shows how the system transforms input
data into useful information.
ERD vs. DFD cont’d
 ERD handles entities somewhat differently
from a DFD in that it shows all entities and
focuses on the relationships among them,
while a DFD shows only external entities
that provide data to the system or receive
data from the system.
Relationships
 A relationship describes the interaction
among entities. For example, a customer
entity can have several instances of an
order entity, and an employee entity can
have one instance, or none, of a spouse
entity.
Relationships Cont’d
There are three types of relationships
 one to one
 one to many
 many to many
Types of Relationships
 A one to one relationship (1:1), exists when
exactly one of the second entity occurs for each
instance of the first entity.

1 1
DEPARTMENT HEADS
DEPARTMENT
HEAD

A department head only heads one department and a department only has one
head.
Types of Relationships Cont’d
 A one to many relationship (1:M), exists when one
occurrence of the first entity can relate to many
instances of the second entity, but each instance
of the second entity can only associate with only
one instance of the first entity.

1 M
EMPLOYS
DEPARTMENT EMPLOYEE

One department employs many employees but an employee only works in one
department.
Types of Relationships Cont’d
 A many to many relationship (M:N), exists when
one instance of the first entity can relate to many
instances of the second entity, and one instance
of the second entity can relate to many instances
of the first entity.

M N
ENROLLS IN
STUDENT COURSE

Registration

One student is enrolled in many courses and a course has many students
Associative Entity
 Notice that an M:N relationship is different
from 1:1 or 1:M relationship because the
event or transaction that links the two entities
is actually a third entity called an associative
entity that has its own characteristics.

M N
Registration
STUDENT COURSE
Cardinality
 Cardinality describes how instances of one
entity relate to instances of another entity.
In a specific relationship, an entity is
mandatory, which means that it is required,
or optional.
 If it is mandatory, only one instance might be allowed in a relationship,
or many instances might be permitted.
Cardinality Cont’d
Sales Rep Product
M Stores
1 Warehouse

1 N

Serves Lists Order-Line

M M
Customer
1 Places
M
Order

An entity-relationship diagram for Sales Rep, Customer, Order, Product, and


Warehouse. Notice that the Order and Product entities are joined by an
associative entity named Order-Line.
Crow’s Foot Notation
 One method used to represent cardinality.
 A single bar indicates one, a double bar
indicates one and only one, a circle
indicates zero, and a crow’s foot indicates
many.
Crow’s Foot Notation
Cardinality Cont’d
Cardinality Cont’d
Sample E-R Diagram

17
Practice Question
UPS prides itself on having up-to-date information on the processing
and current location of each shipped item. To do this, UPS relies on a
company-wide information system. Shipped items are the heart of the
UPS product tracking information system. Shipped items can be
characterized by item number (unique), weight, dimensions, insurance
amount, destination, and final delivery date. Shipped items are received
into the UPS system at a single retail center. Retail centers are
characterized by their type, uniqueID, and address. Shipped items make
their way to their destination via one or more standard UPS
transportation events (i.e., flights, truck deliveries). These transportation
events are characterized by a unique scheduleNumber, a type (e.g,
flight, truck), and a deliveryRoute.

Create an Entity Relationship diagram that captures this information


about the UPS system. Be certain to indicate identifiers and cardinality
constraints.
UPS ERD Solution
Practice Question
 Pick and Shovel Construction Company is a
multi-state building contractor specializing in
medium-priced town homes. The main
entities are its customers, employees,
projects, and equipment. A customer can hire
the company for more than one project, and
employees sometimes work on more than
one project at a time. Equipment, however, is
assigned to one project. Draw an ERD with
cardinality notation showing those entities.

You might also like