You are on page 1of 5

Entity Relationship diagram / ER Model / Relational Model

1 to 1 relationship

Manager

ManagerID (PK) Name Address ContctNo DeptID (FK)


M01 Ali D02
M02 Ahmed D01
M03 Jason D03

Department

DeptID (PK) Name Location ExtensionN


o
D01 Sales
D02 Marketing
D03 IT

ERD Chen’s Notation ERD Crow’s Foot Notation

ManagerID Name

Manager
Manager ManagerID
Name
1

manage
manage

1 Department
DeptID
Department
Name

DeptID Name

Each DeptID is associated to 1 ManagerID & Each ManagerID is associated to 1 DeptID

M01 D02 M02 D01 M03 D03


1 to Many relationship

Customer

CusID (PK) Name Address ContactNo


Cu01 Ali
Cu02 Ahmed
Cu03 John

Order

OrderID (PK) Date Item TotalPrice CusID (FK)


OR01 Mouse, Keyboard 150 Cu02
OR02 Cu02
OR03 Cu01
OR04 Cu03
OR05 Cu01

ERD Chen’s Notation ERD Crow’s Foot Notation

Name
CusID

Customer
CusID
Customer
Name

make
make

Order
M
OrderID
Order
Date

OrderID Date

Each OrderID is associated to 1 CusID, but each CusID is associated to 1 or more than 1 OrderID

CU01 OR03, OR05 CU02 OR01, OR02 CU03 OR04


Many to many relationship

Supplier

SupplierID (PK) Name Address ContactNo


S01 ABC Company KL
S02 XYZ Company PJ
S03 HJK Company PJ
S04 PQR Company JB

Product

ProductID (PK) Name Price QuantityInStock


P01 Keyboard RM80
P02 Mouse RM30
P03 Monitor RM200

Supplies

SuppliesID(PK) SupplierID (FK) ProductID (FK) Date QuantitySupplied


SU01 S01 P01 1 Jan
SU02 S01 P02 2 Jan
SU03 S01 P03 2 Feb
SU04 S02 P03 3 Mar
SU05 S03 P02 1 April

ERD Chen’s Notation ERD Crow’s Foot Notation

SupplierID Name

Supplier
Supplier SupplierID
Name
M

supply
supply

N Product
ProductID
Product
Name

ProductID Name
Each SupplierID is associated to 1 or more ProductID & Each ProductID is associated to 1 or more SupplierID

S01 P01, P02, P03 S02 P03 S03 P02

P01 S01 P02 S01, S03 P03 S01, S02

Resolving ‘Many to Many’ relationship into TWO ‘1 to Many’ relationship

ERD Chen’s Notation

SupplierID Name SuppliesID Date ProductID Name

1 M M 1
Supplier has Supplies has Product

ERD Crow’s Foot Notation

Supplier Supplies Product


has has
SupplierID SuppliesID ProductID

Name Date Name

Each SupplierID is associated to 1 or more SuppliesID, but each SuppliesID is associated to 1 SupplierID

Each ProductID is associated to 1 or more SuppliesID, but each SuppliesID is associated to 1 ProductID

SupplierID SuppliesID ProductID

S01 SU01 P01

SU02

S02 SU03 P02

SU04

S03 SU05 P03

You might also like