0% found this document useful (0 votes)
4 views42 pages

BCS - Cer - IS - Lesson3 - ER Diagrams

The document provides an overview of Entity Relationship Diagrams (ERD) and data modeling concepts, including definitions of entities, attributes, and relationships. It explains various types of attributes, identifiers, and relationship constraints such as cardinality and participation. Additionally, it presents examples of ER diagrams and discusses the relationships between employees, departments, and projects within a company.

Uploaded by

hlt.ariapala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views42 pages

BCS - Cer - IS - Lesson3 - ER Diagrams

The document provides an overview of Entity Relationship Diagrams (ERD) and data modeling concepts, including definitions of entities, attributes, and relationships. It explains various types of attributes, identifiers, and relationship constraints such as cardinality and participation. Additionally, it presents examples of ER diagrams and discusses the relationships between employees, departments, and projects within a company.

Uploaded by

hlt.ariapala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

1

BCS-Certificate in IT

BCS – Higher Education Qualifications


Information Systems
ICTM Campus

- Uditha Priyanga -
2

BCS-Certificate-IS

Data Modeling Using ERD


(Entity Relationship Diagram)
3

ER-Model

▪ An Entity Relationship model is a High Level Conceptual Data


Model
▪ The E-R model is expressed in terms of entities in the business
environment, the relationships among those entities and the
attributes or properties of both entities and their relationships.
▪ An E-R model is expressed as a diagram called E-R Diagram
4

Entity & Entity Type

▪ Entity : A person, place, object, event or a concept that the organisation


wishes to maintain the data Student Course

▪ Entity Type : A collection (or set) of entities that share common properties or
characteristics. Student course

▪ Entity Instance : A single occurrence of an entity type


John BCS
Jane BIT
5

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

An attribute that is not FName LName HNo


Street
having component
Name Address
parts City

StNo Student TelNo

1111
0777355204
Age DOB

20
25/02/2001
8

Composite Attribute

Jimmy Adams 25 Galle-Road Colombo4


An attribute that is
FName LName HNo
having component Street
parts
Name Address
City

StNo Student
TelNo

Age DOB
9

Single Valued Attribute

Jimmy Adams
25 Galle-Road Colombo4
An attribute that has a
FName LName HNo
single value for each Street
entity instance
Name Address
City

1111 StNo Student


TelNo

20 Age DOB
25/02/2001
10

Multi Valued Attribute

FName LName HNo


An attribute that can
Street
have multiple values
Name Address
for single entity City

instance
StNo Student
TelNo

Age DOB
One student may have multiple Telephone Numbers 0771205833
0771123456
0112786934
11

Stored Attribute

Jimmy Adams 25 Galle-Road Colombo4


An attribute whose
FName LName HNo
value is physically
Street
stored in the
Name Address
database City

1111 StNo Student 0771205833


0771123456
TelNo 0112786934

Age DOB
25/02/2001
12

Derived Attribute

An attribute whose FName LName HNo


Street
value is calculated
Name Address
from related stored City
attribute values
StNo Student
TelNo

Age can be calculated from DOB Attribute 20 Age DOB

25/06/2001
13

Identifier

An identifier is set of attributes which uniquely identify each entity


instance of an entity type

1. Simple Identifier
2. Composite Identifier
14

Simple Identifier

A simple attribute that uniquely identify each entity instance of an


entity type

CName Duration

Simple Identifier
C001

Course CFee
CNo
15

Composite Identifier

A composite attribute uniquely identifies each entity instance of an entity type


UL 303

FlightName FlightNo

Composite Identifier FlightID


FlightID UL 303

Capacity
Flight
16

Relationship Type

A meaningful association among entity types


Eg: A student follow course

Relationship Type

Student Course
17

Relationship Instance

Each relationship instance includes exactly one instance of each participating


entity type.
Relationship Instances
Eg: John is Student Course
following HND
R1
Course John HND

Jane R2
R3
Jil BCS
18

Relationship Constraints

▪ Cardinality of relationship : concerns with the number of entity


instances associate in a relationship
▪ Degree of relationship : concerns with the number of entity types
associate in a relationship
▪ Participation of relationship : concerns with the participation of
instances among entity types in a relationship
19

Cardinality of Relationship

Cardinality concerns with the number of entity instances associate in a


relationship
▪ 1:1 - One to One
▪ 1:M - One to Many
▪ M : N - Many to Many
20

One to One (1 : 1)

One Country is ruled by one president and a president rule only one country

PName PAddress CCode CName

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

CNo CName OrNo OrDate

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

Degree concern with the number of entity types associate in a


relationship
1. Unary - Degree 1
2. Binary - Degree 2
3. Ternary - Degree 3
4. N-ary - Degree above 3
24

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

Simultaneous SNo SName PNo PName


relationship among
instances of three * *
Supplier Part
entity types
*
Eg: suppliers supply
parts for projects JNo Project JName

S1,P1,J1 S1,P1,J2 S2,P2,J2


27

N-ary – Degree Above 3

Simultaneous ShNo Shipment ShType


Relationship among *
Instances of more SNo SName PNo PName

than three entity


* *
types Supplier Part

Eg: suppliers supply *


parts for projects JNo Project JName

using many shipments


S1,P1,J1,SH1 S1,P1,J2,SH2 S2,P2,J2,SH3
28

Participation of Relationship

Participation concern with participation of entity instances in a relationship that


can be mandatory or optional.

1. Mandatory : All instances of entity type are participating in the 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

CNo Cname LNo LAmount

Customer Loan
0..* 1..*

Optional Mandatory
30

One to one (Optional to Optional)

a b c d

X Y
0..1 0..1

Optional Optional

X Y
31

One to one (Optional to Mandatory)

a b c d

X Y
0..1 1..1

Optional Mandatory

X Y
32

One to one (Mandatory to Mandatory)

a b c d

X Y
1..1 1..1

Mandatory Mandatory

X Y
33

One to Many (Optional to Optional)

a b c d

X Y
0..1 0..*

Optional Optional

X Y
34

One to Many (Optional to Mandatory)

a b c d

X Y
0..1 1..*

Optional Mandatory

X Y
35

One to Many (Mandatory to Mandatory)

a b c d

X Y
1..1 1..*

Mandatory Mandatory

X Y
36

Many to Many (Optional to Optional)

a b c d

X Y
0..* 0..*

Optional Optional

X Y
37

Many to Many (Optional to Mandatory)

a b c d

X Y
0..* 1..*

Optional Mandatory

X Y
38

Many to Many (Mandatory to Mandatory)

a b c d

X Y
1..* 1..*

Mandatory Mandatory

X Y
39

Multi valued attributes

Relational database model does not support multi valued attributes

EmpNo Name

Employee Skill Multi Valued Attribute


40

Question : Drawing ER Diagram

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

1..* HrsWkd 0..* 0..*

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

You might also like