Professional Documents
Culture Documents
EMPLOYEE
Date_Employed
Identifier Attributes
An identifier attribute is a type of
attribute that uniquely identify every
entity instance
Student_ID in STUDENT entity type
and Employee_ID in EMPLOYEE
Identifier are underlined in Entity
Relationship Diagram(ERD)
Composite Identifier Attribute
Composite identifier is one that
consists of more than one attributes
An entity type may have more than one
identifier
be r
t_ Num Da
h
Flig te
Flight_ID Passenger_Name
Flight
Identifier Selection
Chose an identifier that will not
change its value
The attribute is guaranteed to have a
valid value and not to be Null
Avoid the use of intelligent identifiers or
keys, whose structure shows
classification, location, so on
CASE (Identify Entities & Attributes)
The products of a company are grouped into several product
lines. The identifier for a product is Product ID, whereas the
identifier for a product line is Product Line ID. We identify the
following additional attributes for product: Product Description,
Product Finish, and Product Standard Price. Another attribute
for product line is Product Line Name. A product line may group
any number of products but must group at least one product.
Each product must belong to exactly one product line.
Customers submit orders for products. The identifier for an
order is Order ID, Order Date, Days Passed since order is
placed. A customer may submit any number of orders, but need
not submit any orders. Each order is submitted by exactly one
customer. The identifier for a customer is Customer ID. Other
attributes include Customer Name (First Name, Last Name),
Customer Address (Street No, City, Country), and Customer
Postal Code.
RELATIONSHIPS
Relationships
Relationships are the glue that holds
together the various components of
ER Model
Relationship is an meaningful
association between one or more
entity types that is of interest to the
organization
Relationships
An association representing an
interaction among the instances of one
or more entity types
A relationship has a verb name
A name that describes the nature of the
relationship
- examples:
STDENT takes COURSE,
MANAGER supervises EMPLOYEE,
ENGINEER is assigned to PROJECT,
PART is used in PRODUCT…
Relationships
EMPLOYEE
Is_assigned PARKING PLACE
Completes
EMPLOYEE COURSE
Cardinality of Relationship
Degree of
Relationship
Degree of Relationships
Number of entity types that
participate in a relationship
Degree of Relationships
Following are common degrees in
ER-Model
1. Unary
2. Binary
3. Ternary
4. Higher Degree(Rarely Encountered)
Unary Relationship
A relationship between the instances of
single entity
Manages
Is_Married EMPLOYEE
Person
One-to-many
One-to-one
Binary Relationship
A relationship between the instances
of two entity types
Most common relationship faced
Relationships
EMPLOYEE
Is_assigned PARKING PLACE
VENDOR WAREHOUSE
Supplies
Ternary Relationship
PHYSCIAN TREATMENT
PHY_ID T_Code
Name Treats Description
Cardinality of
Relationship
Cardinality
Specifies the number of instances of
entity A that can (or must be)
associated with each instance of
another entity B
Showing Cardinalities
There are three ways of labeling
cardinalities:
0 Zero
| One
Many
Cardinalities on ERD
There are two type of cardinalities are
represented on ERD
1. Minimum Cardinality
2. Maximum Cardinality
Minimum Cardinality
Minimum number of instances of one
entity that may be associated with
each instance of another entity
It can be 0,1
Maximum Cardinality
Maximum number of instances of one
entity that may be associated with
each instance of another entity
It can be 1 or many
Minimum Maximum
Cardinality Cardinality
Mandatory One
Zero or One
Mandatory Many
Optional Many
Discovering Cardinality
Cardinality of the relationship is
sometimes implement the Rules of the
organization
Discovering Cardinality is tricky
Two Methods are used for this purpose:
Question Method
Entity Instance Method
Question Method
We ask Two questions
And Answer the question
Each question start with one
Question Method
• QUESTION: One customer Receives how many invoices
• Answer: One or Many
Has PATIENT
PATIENT
HISTORY
One – to- Many
Mark visit 1
Sarah visit 1
visit 2
Tom visit 1
Cardinality
Is_assigned
EMPLOYEE PROJECT
Rose Database
Pete TQM
Tom OOP
Fred Research
Examples
Manages
EMPLOYEE
Is_assigned
EMPLOYEE PARKING PLACE
CASE (Identify Cardinality)
The products of a company are grouped into several product
lines. The identifier for a product is Product ID, whereas the
identifier for a product line is Product Line ID. We identify the
following additional attributes for product: Product Description,
Product Finish, and Product Standard Price. Another attribute
for product line is Product Line Name. A product line may group
any number of products but must group at least one product.
Each product must belong to exactly one product line.
Customers submit orders for products. The identifier for an
order is Order ID, Order Date, Days Passed since order is
placed. A customer may submit any number of orders, but need
not submit any orders. Each order is submitted by exactly one
customer. The identifier for a customer is Customer ID. Other
attributes include Customer Name (First Name, Last Name),
Customer Address (Street No, City, Country), and Customer
Postal Code.
CASE (Make an ERD)
The identifier for a product is Product ID. We identify the following
additional attributes for product: Product Description, Product Finish,
and Product Standard Price. Each product is assembled from a
specified quantity of one or more raw materials. The identifier for the
raw material entity is Material ID. Other attributes include Unit Of
Measure, Material Name, and Material Standard Cost. Each raw
material is assembled into one or more products, using a specified
quantity of the raw material for each product.
Raw materials are supplied by vendors. The identifier for a vendor
is Vendor ID. Other attributes include Vendor Name and Vendor
Address. Each raw material can be supplied by one or more vendors.
A vendor may supply any number of raw materials or may not supply
any raw materials to Pine Valley Furniture. Supply Unit Price is the
unit price a particular vendor supplies a particular raw material.
Special Cases
Some time we have to handle some
special case in ERD such as:
Attributes on Relationships
Attribute or Relationship
Multiple Relationships
Many to Many Relationships
Ternary Relationship