BCS - Cer - IS - Lesson3 - ER Diagrams
BCS - Cer - IS - Lesson3 - ER Diagrams
BCS-Certificate in IT
- Uditha Priyanga -
2
BCS-Certificate-IS
ER-Model
▪ Entity Type : A collection (or set) of entities that share common properties or
characteristics. Student course
Attribute
A property or a Attributes
characteristic of
an entity type CName Duration
that represent
data CNo
Course CFee
Entity Type
6
Types of Attribute
▪ Simple Attribute
▪ Composite Attribute
▪ Single Valued Attribute
▪ Multi Valued Attribute
▪ Stored Attribute
▪ Derived Attribute
7
Simple Attribute
1111
0777355204
Age DOB
20
25/02/2001
8
Composite Attribute
StNo Student
TelNo
Age DOB
9
Jimmy Adams
25 Galle-Road Colombo4
An attribute that has a
FName LName HNo
single value for each Street
entity instance
Name Address
City
20 Age DOB
25/02/2001
10
instance
StNo Student
TelNo
Age DOB
One student may have multiple Telephone Numbers 0771205833
0771123456
0112786934
11
Stored Attribute
Age DOB
25/02/2001
12
Derived Attribute
25/06/2001
13
Identifier
1. Simple Identifier
2. Composite Identifier
14
Simple Identifier
CName Duration
Simple Identifier
C001
Course CFee
CNo
15
Composite Identifier
FlightName FlightNo
Capacity
Flight
16
Relationship Type
Relationship Type
Student Course
17
Relationship Instance
Jane R2
R3
Jil BCS
18
Relationship Constraints
Cardinality of Relationship
One to One (1 : 1)
One Country is ruled by one president and a president rule only one country
1 1
President Country
A B
one instance of entity A can be associated with only one instance of entity B, and
one instance of entity B can be associated with only one instance of entity A.
21
One to Many (1 : M)
One customer can place many orders and one order is from only one customer
1 *
Customer Order
A B
one instance of entity A can be associated with many instances of entity B, but
one instance of entity B can be associated with only one instance of entity A.
22
Many to Many (M : N)
One student can follow many courses and one course can be followed by many
students
StNo SName CCode CTitle
* *
Student Course
A B
one instance of entity A can be associated with many instances of entity B, and
one instance of entity B can be associated with many instances of entity A.
23
Degree of relationship
Unary – Degree 1
Relationship among
instances of same(one) Recursive Relationship
EmpNo
entity type
1
*
Eg: One employee can EName
Employee
manage many employees
25
Binary – Degree 2
Relationship
among Instances
of two entity
CNo CName OrNo OrDate
types
1 *
Customer Order
Eg: Customer
place orders
26
Ternary – Degree 3
Participation of Relationship
2. Optional : At least once instances of entity type does not participating in the
relationship
29
Participation
Eg: Customer in the loan relationship is optional and the loan in the customer
relationship is mandatory
Customer Loan
0..* 1..*
Optional Mandatory
30
a b c d
X Y
0..1 0..1
Optional Optional
X Y
31
a b c d
X Y
0..1 1..1
Optional Mandatory
X Y
32
a b c d
X Y
1..1 1..1
Mandatory Mandatory
X Y
33
a b c d
X Y
0..1 0..*
Optional Optional
X Y
34
a b c d
X Y
0..1 1..*
Optional Mandatory
X Y
35
a b c d
X Y
1..1 1..*
Mandatory Mandatory
X Y
36
a b c d
X Y
0..* 0..*
Optional Optional
X Y
37
a b c d
X Y
0..* 1..*
Optional Mandatory
X Y
38
a b c d
X Y
1..* 1..*
Mandatory Mandatory
X Y
39
EmpNo Name
A company is having multiple Departments, Employees are attached to departments. One employee
is assigned to a single department and many employees are attached to one department. Each
employee is having a unique EmpNo, Name (Fname, LastName), DOB, Age and multiple Skills. Each
department is having a unique DeptNo, Name and location. Employees may have one or more
dependents and the Name and DOB of dependents must be recorded.
One department control many Projects and a project is controlled by only one department. Each
project is having unique ProjNo, Titile, Duration. One Employee can be assigned to many projects and
a project is done by multiple employees. It is important to record the hours worked by each employee
worked on each project. Some departments do not control projects and some employees are not
involved with project work. Not all employees are attached to deparments.
FName LName
41
Answer
EmpNo
DepNo DName
Name
0..* 1..1
Location
DOB Employee Department
0..* Skill
Skill 0..1
Age 0..1
Dependent
Dependent
Project
Duration
DName DDOB
PNo PName
42
Thank you…
K. K. Uditha Priyanga
PGD-SITM, BCS-PGD, Dip-ACS,NCC-IDCS-UK,MBCS,MCS
Managing Director / Senior Lecturer – ICTM Campus