You are on page 1of 25

Database Systems

Database Design

Dr. Maqbool Khan

1 www.pktutorials.com
Overview of Database Design
1. Requirements collection and analysis:

▪ DB designers interview the users and specify:


- the data requirements of the DB
- functional requirements: user-defined operations

▪ The result is a written set of requirements (users’ expectations)

2
Overview of Database Design
2. Create a conceptual schema:

▪ Concise description of the data requirements

▪ Detailed descriptions of the entity types, relationships, and constraints

▪ This step helps the designers concentrate on the data’s properties (and not
worry about how the data will be stored)

▪ Basic data model operations can be used to specify the high-level user
queries and operations identified during functional analysis

3
Overview of Database Design

3. Logical Design: Choice of a DBMS and Actual Implementation of the DB

▪ Data model mapping (Logical Design): Map the conceptual schema into the
data model of the selected DBMS

▪ - e.g., from ER model to relational model

4
Overview of Database Design

4. Physical design

▪ internal storage structures, file organizations, indexes, etc., are specified

▪ Application programs are designed

5
Database Design

▪ A good database design is essential to get a functional and usable database!

▪ Conceptual DB design is one of the main steps

▪ ER Model is a popular high-level conceptual data model

6 www.pktutorials.com
Entity-Relationship Modeling:

▪ ER model is a logical representation of data in an organization.


▪ It views the entire system as a collection of entities related to one another.
▪ It is used to describe the elements of a system and their relationships.
▪ It was introduced by Peter Chen in 1976.
▪ It develops a conceptual design for the database.
▪ It also develops a very simple and easy to design view of data.

7 www.pktutorials.com
Entity-Relationship Modeling:

ER-Model
▪ The Entity–Relationship (ER) model is a top-down approach to database design
▪ It begins by identifying the important data called entities and relationships
between the data that must be represented in the model.
▪ We use popular object-oriented modeling language of diagrammatic notation
called the Unified Modeling Language (UML)

8 www.pktutorials.com
Terminologies in ER Model
▪ Entity:
- Objects that exist independently (for example car, person, employee etc.)
- The existence may be conceptual as well ( for example course, job etc.)
- An entity is a person , place, thing or event for which data is collected and maintained.
- In the ER diagram, an entity can be represented as rectangles.
- For Example, BOOK and MEMBER are entities in a library system.
- A college system may include entities like STUDENT, TEACHER, and CLASS.

9 www.pktutorials.com
Terminologies in ER Model

E.g., we have two entities Student and College, and these two entities have many to
one relationship as many students' study in a single college.

10 www.pktutorials.com
Components of ER Model:
Entities
• Entity is used in three different meanings that are as follows:

a. Entity Type
• A set of entities with same attributes is called entity type.
• All entities in an entity type share common characteristics.
• It is known as entity class.
• E.g., STUDENT entity class is a set of all students.

11 www.pktutorials.com
Components of ER Model:

b. Entity Instance
▪ A member of an entity class is known as an entity instance.
▪ It is also known as entity occurrence.
▪ Each entity instance of an entity type has its own value for each instance.
▪ e.g., a student Ahmed of STUDENT entity type is an entity instance.

For example, there is one EMPLOYEE entity type in most organizations, but
there may be hundreds (or even thousands) of instances of this entity type
stored in the database.

12 www.pktutorials.com
Components of ER Model:
Entity
Entity Instance Entity Type Instance

Properties of
Entity
Entity Type
Instance

13 www.pktutorials.com
Difference between Entity Type and Entity Instance:

Entity Type Entity Instances


Share common characteristics Single occurrence of an entity type
(often corresponds to row in a table)
Given a name (capital letters) E.g., may be 100 instances of entity
EMPOLYEE stored in a database.
Rectangle
Collection of entities (often
corresponds to table)
e.g., EMPOLYEE

14 www.pktutorials.com
Components of ER Model:

c. Entity Set
▪ A set of all entities of a particular entity type in the database at a given point
of time is called entity set.
▪ E.g., an entity set Student may consist of all students in the university.

15 www.pktutorials.com
Components of ER Model:
Entity Set Entity Set
Entity Type

Properties of
Entity Type

16 www.pktutorials.com
Components of ER Model: Entity Types
Weak Entity Type
▪ An entity type whose existence depends on some other entity type.
▪ An entity type whose instances cannot exist without being linked with the
instances of some other entity types.
▪ Entity types that do not have key attributes of their own
▪ Car’s color is a weak entity since two or more cars can share the same color
▪ A weak entity type has no business meaning in an E-R diagram without the
entity on which it depends.
▪ They cannot exist independently.
▪ It has a partial identifiers.
▪ It is also called child, dependent or subordinate entity.

17 www.pktutorials.com
Components of ER Model:
Representation of Weak Entity
▪ A double rectangle is used for representing a weak entity set.
▪ The double diamond symbol is used for representing the relationship between a
strong entity and weak entity which is known as identifying relationship.
▪ Double lines are used for presenting the connection with a weak entity set with
relationship.
▪ Simply a weak entity is nothing but an entity which does not have a primary key
attribute.

Weak Entity

18 www.pktutorials.com
Components of ER Model:
▪ As weak entity does not has any key attribute but we need some
attribute which along with the primary key of the dominant entity
allows the subordinate entity to be identified uniquely.
▪ This attribute is called the discriminator of the weak entity. It is
also called as the partial key.

19 www.pktutorials.com
Components of ER Model:
Weak Entity Type-Example
▪ We want to store the data of a student after assigning a class to him.
▪ It means data cannot be stored if CLASS entity does not exist.
▪ In order to store record of the student, we first need to create an entity that
represents a class.
▪ Here, STUDENT is a weak entity because it depends upon CLASS entity.

20 www.pktutorials.com
Components of ER Model:
Strong Entity Type
▪ An entity type that exists independently of other entity types.
▪ An entity type whose instances can exist independently.
▪ The entity type have there own identity.
▪ It always have a identifier.
▪ It is also called Identifying owner.
▪ It is also called parent, owner or dominant entity.
▪ In previous example, CLASS is strong entity.

21 www.pktutorials.com
Difference between Strong Entity and Weak Entity:

22 www.pktutorials.com
Components of ER Model:
Representation of Strong Entity
▪ The strong entity is represented by a single rectangle.
▪ Relationship between two strong entities is represented by a single diamond.
▪ The primary key of the strong entity is represented by underlining it
▪ The relationship between a weak entity type and strong entity type is called
an ‘identifying relationship’ and shown with a double outlined diamond
instead of a single outlined diamond.

Strong Entity

23 www.pktutorials.com
Components of ER Model:

PersonID Name Birthdate


ChildName

PERSON Has CHILD

24 www.pktutorials.com
THANKS

25 3/19/2024 www.pktutorials.com

You might also like