You are on page 1of 34

Database Systems

(ECEg4172)
Prepared by Kelele G.

1
Chapter 2
Database Design

2
Outlines
• Introduction
• Database design steps
• Conceptual design
• Logical design
• Physical design

3
Introduction
• Database Design is a collection of processes that facilitate the designing,
development, implementation and maintenance of enterprise’s,
company’s’ or organization’s data management systems according to
a database model.
▪ Enterprise’s, company’s or organization’s have two major components in
their working environment.
1) Process:- can be handled through application software.
2) Data: - can be managed through database.
▪ Database model:- can be
1) Hierarchical data model
2) Network data model
3) Relational data model

4
Cont.…
• Database design involves classifying data and identifying interrelationships.
• Properly designed databases have the following characteristics
1) Easy to maintain
2) Improve data consistency and
3) Avoid redundancy
4) High performance
• The two most common techniques used to design a database include:-
1) Entity-Relationship (ER) Modelling: It’s a graphical database design approach
that models entities, their attributes, and defines relationships among these
entities to signify real-life objects. Mostly used in database conceptual design.
2) Normalization: a techniques used in such a way that it decreases data
redundancy and dependency. Larger tables are divided into smaller tables and
are linked together using relationships. Mostly used in database logical
design.

5
Database design steps Database Designing Steps
✓ Within the real world, there exists
App Development Steps many aspects(problems) that can be
converted into apps and database.
✓ Through interview, questionnaire,
observation and document analysis;
the requirements will get gathered
and the existing problems can be
clearer to the app developers and
database designer.
✓ While requirement analyzing,
problem’s process and data can be
separated effectively, and handled
separately. The processes will be
handled by the app developer, and
the data can be handled by the
database designer.

6
Requirement Analysis
• Done after requirement collection is done.
• Ambiguity and feasibility problems will get identified and will be
discussed with the stakeholders.
• Objects and their attributes will get identified.
• Interaction in between objects will get identified.

7
Conceptual Design
• Model data requirements in to develop a high-level description of the data
to be stored in the database
• This approach enables database designers to concentrate on specifying the
properties of the data, without being concerned with storage and
implementation details.
• Can be modelled using entity-relationship data model.
• The ER data model views the real-world aspects as a set of
▪ Objects (Entities), and
▪ Relationships among these objects.
• The three basic notions of the ER data model are:-
1) Entity
2) Attribute
3) Relationship
8
Cont.…
• Entities are usually recognizable concepts, either concrete or abstract, such
as:
▪ Person, department, instructor, student, course, place, thing, or events which have
relevance to the database.
▪ Entity Set is a set consisting of the same type of entities that share same properties.
An entity is described using a set of attributes. All entities in a given entity set have
the same attributes.
▪ Instance is also known as Object, is an individual occurrence of an entity set.
▪ While analyzing problem, the entities are recognized by nouns and noun phrases.
• Entities can be classified as:-
1) Strong (independent) entity:- One that does not rely on other entities for
identification.
2) Weak (dependent) entity:- one that relies on other entities for identification.

9
Cont.…
• A strong entity is an entity which has it’s own unique key that can uniquely
identify it from other similar entities, and can exist in the database system
independently.
• A weak entity is uniquely identified with the help of other strong entity.
• A weak entity can not exist in the database system without a strong entity
which owns it.
• For example:-
1) Within flight booking, a booking entity can be created if and only if a customer
entity is created. Implies, a customer entity owns booking entity.
2) Within ecommerce, an order entity can be created if and only if a customer entity
is created. Implies, a customer entity owns order entity.
• Weak entity attribute/s are called discriminators.
10
Cont.…
• Attributes are descriptive properties that are associated with an
entity.
▪ Value is a particular instance of an attribute.
▪ Domain of an attribute is the collection of all possible values an attribute can
have.
▪ For example:-
✓ A Person entity can be described by attributes first name, middle name, last name, birth
date and more . . .
✓ A Department can be described by attributes department name, department
description and more . . .
✓ A Course can be described by attributes course name, course code, course description,
credit hour and more . . .

11
Cont.…
• Classification of Attributes
1) Identifiers:- more commonly called keys, that can uniquely identify an
instance of an entity. Commonly called primary key.
2) Descriptors:- describes a non-unique characteristic of an entity instance.
▪ For example:-
✓A Student entity can be described by the attributes student id, name, gender,
birth date, address etc. Here as you all know, within the UoG’s SIS, no two or
more students can have the same student id(means this student id uniquely
identifies a student, called identifier) but can have the same name or birth date
or gender, called descriptors.

12
Cont.…
3) Composite attributes:- can be divided into smaller parts, which represent
more basic attributes with independent meanings.
▪ For example:-
✓A Student entity can be described by the attributes student id, name,
gender, birth date, age, address, degree etc.
✓But here, the name can be divided into first name, middle name, and last
name independent attributes.
✓And, the address can be divided into street name, city, state, phone
number, email independent attributes.
4) Atomic attributes:- attributes that are not divisible are called simple or
atomic attributes. Such as student id, student's gender and student’s birth
date, age, and degree.

13
Cont.…
3) Single-valued attributes:- most attributes have a single value for a
particular entity; such attributes are called single-valued.
▪ For example:-
✓Age, birth date are a single-valued attribute of a Student.
4) Multi-valued attributes:- some attribute may have multiple values.
▪ For example
✓a Student may not have a college degree, another Student may have one,
and a third Student may have two or more degrees; therefore, different
people can have different numbers of values for the degrees attribute.

14
Cont.…
5) Derived attributes:- In some cases, two or more attribute values are
related.
▪ For example:-
✓The Age and Birth date attributes of a Student. For a particular Student
entity, the value of Age can be determined from the current date and the
value of that Student’s Birth date.
✓The Age attribute is hence called a derived attribute and is said to be
derivable from the Birth date attribute.
6) NULL Values:- In some cases, a particular entity may not have an applicable
value for an attribute.

15
Cont.…
• Relationship represents an association between two or more entities.
▪ For example:-
✓A Department contains Students.
✓A Department contains Instructors.
✓An Instructors manages a department.
✓A Student takes courses.
▪ Classification of relationships:-
1) Degree of relationship:- describe the number of entity types that are
participating in a relationship type.
2) Cardinality of relationship:- the cardinality ratio for a binary
relationship specifies the maximum number of relationship instances
that an entity can participate .

16
Cont.…
• Degree of relationship
1) Unary(recursive) relationship:- this kind of relationship is occurred when an
entity is related with itself.
2) Binary relationship:- this kind of relationship is occurred when two entities
are related to other.
3) Tertiary relationship: - this kind of relation is occurred when

17
Cont.…
• Cardinality of relationship
a) one-to-one
b) one-to-many
c) many-to-many

▪ For example:-

18
Cont.…
• ER data model is represented using ER-diagram symbols. Such as

19
Cont.…
• Example-1:-
▪ A Department entity can be ▪ Associating the Department entity
represented like, Department with it’s attributes

▪ The attributes that can define the Code


Department entity
For:-
✓ Department code Code Name

Department
✓ Department name Name Description

✓ Department description Description


20
Cont.…
• Example-2:-
▪ A Course entity can be represented ▪ Associating the Course entity with
like, Course it’s attributes

▪ The attributes that can define the Code


Course entity
For:-
✓ Course code Code Title

Course
✓ Course title Title Hour

✓ Course hour Hour


21
Cont.…
• Example-3:-
▪A Student entity can be ▪ Associating the Student entity
represented like, Student with it’s attributes

▪ The attributes that can define the Id


Student entity Id Name

Name Gender

Gender Birthdate
Student
Birthdate Address

Address Age

Age 22
Cont.…
• More on Student entity:-
• The Student name can be divided • The Student addres can be divided
into subparts, more independent into subparts, more independent
attributes, such as first name, attributes, such as first name,
middle name, last name. middle name, last name.
representing it in a diagram representing it in a diagram
Firstname Streetname

Name Middlename City


Address State
Lastname
phone

email

23
Cont.…
• More on Student entity:-
• The Student age can be derived or • Finally, the Student will be
calculated from the Student birth represented like this,
date. Firstname
Age
Middlename Id
Id
Lastname Name
Name
Streetname Gender
Gender Student
City Birthdate
Birthdate
State Address
Address
phone Age
email 24
Cont.…
• Example-4:- defining a relationship between the entities Department and Student.
▪ A Department contains Students. Lastname

Firstname
Name
Middlename
Code
Id
Contains Student
Gender
Name

Birthdate
Description Department Address
Age

email

City Streetname State phone


25
Cont.…
• More on the relationship between the entities Department and Student.
▪ Adding cardinality, a Department can have one or more Students, and Lastname
a Student only have one Department. Firstname
Name Middlename
Code
1, * Id
Contains Student
Gender
Name
1
Birthdate
Description Department Address
Age

email

City Streetname State phone


26
Cont.…
• Example-5:- defining a relationship between the entities Course and Student.
▪ A Department contains Students. Lastname

Firstname
Name
Middlename
Code
Id
Takes Student
Gender
Title

Birthdate
Hour Course Address
Age

email

City Streetname State phone


27
Cont.…
• More on the relationship between the entities Course and Student.
▪ Adding cardinality, a Student can take one or more Courses, and a Lastname
Course can be taken by many Students. Firstname
Name
Middlename
Code
1,* Id
Takes Student
Gender
Title
1, *
Birthdate
Hour Course Address
Age

email

City Streetname State phone


28
Cont.…
• Example-6:- defining a relationship between the entities Course and Department.
▪ A Department contains Courses.

Code
Has Department
Code

Name
Title

Description
Course
Hour

29
Cont.…
• More on the relationship between the entities Course and Student.
▪ Adding cardinality, a Department can have one or more Courses, and a Course has
only one Department.

1
Code
Has Department
Code

Name
Title
1,*
Description
Course
Hour

30
Cont.…
• Finally, the ER diagram that can define the relationship between Department, Course and
Student will look like the diagram below. Lastname
Code Firstname
Department 1 Name
Name Middlename
1
Description 1, *
Contains Id
Student
1,* Gender
Has
Takes
Birthdate
Address
1, * 1, * Age
Code
Course
Title email
Streetname
Hour City State phone
31
ER Diagram Tools
• Lucidchart
• Visio
• Gliffy
• Visual Paradigm
• SmartDraw
• SqlDBM
• DbDiagram
• Cacoo
• EdrawMax
• Draw.io

32
Cont.…
• Exercise:- Suppose a company manager wants a database system for his company and
asked to develop it and gave you the following requirements.
✓The company is organized into departments. Each department has a unique name, a
unique number, and a particular employee who manages the department. We keep
track of the start date when that employee began managing the department. A
department may have several locations.
✓A department controls a number of projects, each of which has a unique name, a
unique number, and a single location.
✓We store each employee’s name, Social Security number, address, salary, gender, and
birth date. An employee is assigned to one department, but may work on several
projects, which are not necessarily controlled by the same department. We keep
track of the current number of hours per week that an employee works on each
project. We also keep track of the direct supervisor of each employee (who is
another employee).
✓We want to keep track of the dependents of each employee for insurance purposes.
We keep each dependent’s first name, sex, birth date, and relationship to the
employee.
33
Part One

34

You might also like