Unit 4: Database Design & Development
ERD (Entity Relationship Diagram) Part 1
1
What is ERD?
• It is modeling tool used to represent graphically a
database design before it is actually implemented
Determining user and system requirements
2
Lesson Title UNIT TITLE UNIT 3 PROFESSIONAL PRACTICE
An entity
• An entity is a person, a place, an object, an event, or
a concept in the user environment about which the
organization wishes to maintain data
3
Lesson Title UNIT TITLE UNIT 3 PROFESSIONAL PRACTICE
An Attribute
• Attribute A property or characteristic of an entity or
relationship type that is of interest to the
organization.
4
Lesson Title UNIT TITLE UNIT 3 PROFESSIONAL PRACTICE
Composite attribute Vs. atomic
attribute
▪ Composite attribute • Simple (or atomic) attribute
• Composite attribute An • Simple (or atomic) attribute An
attribute that has meaningful attribute that cannot be broken down
component parts (attributes). into smaller components that are
meaningful to the organization.
5
Multivalued attribute Vs. Single Valued
▪ Multivalued attribute • Single Valued ATTRIBUTE
• Multivalued attribute An • Single Valued attribute An
attribute that may take on attribute that may take only
more than one value for a one value for a given entity (or
given entity (or relationship) relationship) instance.
instance.
6
Stored versus derived attributes
▪ derived attributes • Stored ATTRIBUTE
• An attribute whose values can • An attribute whose values can
be calculated from related be stored in the database
attribute values.
7
Identifiers
▪ Candidate Key
▪ All available unique, required identifiers of an entity
Notation:
▪ Primary Key
▪ A unique, required identifier of an entity
▪ The best one of candidate keys
Notation:
▪ Foreign Key
▪ A reference key to another entity
▪ This key is the primary key of another entity
Notation:
Ishani Jayasuriya - DDD - RQF
Why is it important to identify primary key?
▪ The primary key is the main “Handle” that the database server uses
to grab the information in which you are interested.
▪ By identifying a primary key, you are telling the server which
information you want to work with at the moment.
9
Foreign Key
▪ A primary key of one table that is included in another
table.
▪ Links the records in one database table to another table.
Note: Identifiers can be either simple or composite
WHAT IS A RELATIONSHIP?
Meaningful association among several entities.
11
RELATIONSHIP :
A set of relationships of the same type.
Notation :
RELATIONSHIP TYPE :
A relationship between a strong & weak
entity.
Notation :
Has
Ishani Jayasuriya - DDD - RQF
Example :
Fname
Emp ID
Name
Employee
LName
Contact
Works Hrs
on Worked
Project
Ishani Jayasuriya - DDD - RQF
Proj ID
CARDINALITY OF RELATIONSHIP
It expresses the number of entity instances related
a single entity instance of the other participating
type in a relationship set.
▪One to many
▪One to one
▪Many to many
Ishani Jayasuriya - DDD - RQF
One to many (1 : M)
E.g. : One Customer can place many Orders but one
Order is always from one Customer.
1 M
Customer Place Order
Ishani Jayasuriya - DDD - RQF
One to one (1 :1)
E.g. : One President can rule only one Country and one
Country is ruled by only one President.
1 1
President Rule Country
Ishani Jayasuriya - DDD - RQF
Many to many (M : N)
E.g. : One lecture can teach many Students and one
Student may have many Lecturers.
M N
Lecturer Teach Student
Ishani Jayasuriya - DDD - RQF
Thank You !
To be Continued
18