Beruflich Dokumente
Kultur Dokumente
Presented By
Shoaib Khalid FA16-BSE-048
Muhammad Tayyab FA16-BSE-042
Ahmed Jamal FA16-BSE-016
Awais Hameed Rana FA16-BSE-006
Syed Amar Abbas FA16-BSE-070
1
Over View of ERD
Def: A logical representation of the data for an organization or for a business area, using
entities for categories of data and relationships for associations between entities that is
represented by some graphical notation.
Major Elements
Entities
Relationships
Attributes
2
Basic E-R notation (Figure 3-2)
Entity
Attribute
symbols
symbols
A special entity
that is also a Relationship
relationship symbols
Relationship
degrees specify
number of
entity types Relationship
involved cardinalities
specify how
many of each
entity type is
allowed
3
Entities
4
Types of Entity
Strong versus weak entity types
Strong entity type (Independent Entity): An entity that exists independently of other entity
types.
has its own unique identifier
identifier underlined with single-line
Examples include STUDENT, EMPLOYEE, AUTOMOBILE, and COURSE
Weak entity type (Dependent Entity): An entity type whose existence depends on some
other entity type.
does not have a unique identifier (only a partial identifier)
Partial identifier underlined with double-line
Entity box has double line
5
Strong vs. Weak Entities
6
ERD-Attributes
8
Classifications of attributes:
An attribute
broken into
component parts
9
Classifications of attributes:
Multivalued
an employee can have
more than one skill
10
Classifications of attributes:
Derived
from date
employed and
current date
11
ERD-Relationships
Degree of relationships
Entities of two
One entity different types
related to related to each
another of the other
same entity type Entities of three
different types
12
related to each other
ERD-Relationships
a) Unary relationships
13
ERD-Relationships
Figure 3-12 Examples of relationships of different degrees (cont.)
b) Binary relationships
14
ERD-Relationships
15
Note: a relationship can have attributes of its own
ERD-Relationships
Figure 3-11b An associative entity (CERTIFICATE)
Associative entity is like a relationship with an attribute, but it is also considered to be an entity in
its own right.
Note that
Lecture No. 3 the many-to-many cardinality between entities in Figure 3-11a has been16 replaced by two
one-to-many relationships with the associative entity.
E-R Model Constructs – Relationships
Cardinality of Relationships
One-to-One
Each entity in the relationship will have exactly one related entity
One-to-Many
An entity on one side of the relationship can have many related entities, but an entity
on the other side will have a maximum of one related entity
Many-to-Many
Entities on both sides of the relationship can have many related entities on the other
side
17
Sample E-R Diagram (Figure 3-1)
18
Sample E-R Diagram (Figure 3-1)
1. A SUPPLIER may supply many ITEMs (by “may supply,” we mean the supplier may not
supply any items). Each ITEM is supplied by any number of SUPPLIERs (by “is supplied,”
we mean that the item must be supplied by at least one supplier). See annotations in
Figure 2-1 that correspond to underlined words.
2. Each ITEM must be used in the assembly of at least one PRODUCT and may be used in
many products. Conversely, each PRODUCT must use one or more ITEMs.
3. ASUPPLIER may send many SHIPMENTs. However, each shipment must be sent by exactly
one SUPPLIER. Notice that sends and supplies are separate concepts. A SUPPLIER may be
able to supply an item, but may not yet have sent any shipments of that item.
4. A SHIPMENT must include one (or more) ITEMs. An ITEM may be included on several
SHIPMENTs.
5. ACUSTOMER may submit any number of ORDERs. However, each ORDER must be submitted
by exactly one CUSTOMER. Given that a CUSTOMER may not have submitted any ORDERs,
some CUSTOMERs must be potential, inactive, or some other customer possibly without
any related ORDERs.
6. An ORDER must request one (or more) PRODUCTs. A given PRODUCT may not be requested
on any ORDER, or may be requested on one or more orders.
19
Draw ERD
20
Draw ERD