Database Design Theory
Database Design Theory
DATABASE FUNDAMENTALS
TOPIC 2 - DATABASE DESIGN THEORY
Entity
• An entity set is a set of same type of entities.
Entity Examples
Person EMPLOYEE, STUDENT, PATIENT
Place STORE, WAREHOUSE
Object MACHINE, PRODUCT, CAR
Event SALE,REGISTRATION, RENEWAL
Concept ACCOUNT, COURSE
Types of Entity Sets
• An entity set may be of the following two types-
1. Strong Entity Set
• A strong entity set is an entity set that contains sufficient attributes
to uniquely identify all its entities.
• In other words, a primary key exists for a strong entity set.
• Primary key of a strong entity set is represented by underlining it.
2. Weak Entity Set
• A weak entity set is an entity set that does not contain sufficient
attributes to uniquely identify its entities.
• In other words, a primary key does not exist for a weak entity set.
• However, it contains a partial key called as a discriminator.
• Discriminator can identify a group of entities from the entity set.
• Discriminator is represented by underlining with a dashed line.
Example of Entity
Differences between Strong entity set and
Weak entity set-
Strong entity set Weak entity set
A single rectangle is used for the A double rectangle is used for the
representation of a strong entity set. representation of a weak entity set.
It contains sufficient attributes to form its It does not contain sufficient attributes to
primary key. form its primary key.
A double diamond symbol is used for the
A diamond symbol is used for the
representation of the identifying relationship
representation of the relationship that exists
that exists between the strong and weak entity
between the two strong entity sets.
set.
A single line is used for the representation of A double line is used for the representation
the connection between the strong entity set of the connection between the weak entity
and the relationship. set and the relationship set.
Total participation may or may not exist in Total participation always exists in the
the relationship. identifying relationship
Important Note
• Weak entity set is always present in total participation with the
identifying relationship set.
Attributes
• Attributes are associated with an entity set.
• Attributes describe the properties of entities in the entity set.
• Based on the values of certain attributes, an entity can be identified
uniquely.
Types of Attributes
1 1
Personal received Payroll
Each record in the Personal table is about one
employee. That record relates to one, and only
one, record in the Payroll table.
1 M
Customers makes Orders
The Customers table holds a unique record for each customer. Each
customer can place many orders.
Many records in the Orders table can relate to only one record in the
Customers table. This is a one-to-many relationship (1:M) between the
Customers table and the Orders table.
Many-To-Many Relationship
• In a many-to-many (M:N) relationship, a row in table A can have many
matching rows in table B, and vice versa.
M N
Employees assigned Project
Each project can involve more than one
employee and each employee can be
working on more than one project.