You are on page 1of 22

FP 304 DATABASE

SYSTEM
2. 0 RELATI ONAL DATA MODEL
Tankertanker Design
Tankertanker Design
Tankertanker Design
This topic provides the foundation for using relational
database. Discussions on relation scheme, relation
instance, relation keys, relationships, and integrity
rules are covered in the topic. This topic also describes
the fundamental operators to retrieve information
from relational database such as; select, project, join,
cross product, and set operators: union, intersect, and
difference. This topic also will cover on Normalization
in database which consists of 1NF, 2NF, 3NF, BCNF
and how to apply in it based on table/situation given.
OBJECTIVES
Tankertanker Design
Tankertanker Design
Tankertanker Design
Normalization
A process for assigning attributes
into a table and reduces data
redundancy and helps eliminate
the data anomalies that associated
with poor database design
(un-normalized)
Tankertanker Design
Tankertanker Design
Tankertanker Design
The purposes of normalization
To ensure that the anomalies doesnt occur
To reduce data or storage redundancy
To ensure easy for record searching/finding
Tankertanker Design
Tankertanker Design
Tankertanker Design
Steps in Normalization
UNF

1NF 2NF 3NF
Remove repeating groups
Identify functional dependencies
Remove transitive dependencies
Tankertanker Design
Tankertanker Design
Tankertanker Design
Functional Dependecies
F
u
n
c
t
i
o
n
a
l

D
e
p
e
n
d
e
n
c
i
e
s

Functional dependencies
describe relationships between
attributes in a relation
A relationship between attributes
in which one attribute or group of
attribute determines the value of
another in the same table
Tankertanker Design
Tankertanker Design
Tankertanker Design
Transitive Dependencies
T
r
a
n
s
i
t
i
v
e

D
e
p
e
n
d
e
n
c
i
e
s

A Functional dependency between 2 or more
non-key attributes
A condition in which an attribute is
dependent on another attributes that is not
part of the primary key
A relation is in 3NF if it is in 2NF and has no
transitive dependencies
Non-primary key attribute is functionally
dependent on another non-primary key
attribute
Tankertanker Design
Tankertanker Design
Tankertanker Design
Normalize the table below:
Task ID #
Task
Description
Employee ID # Due Date Last Name
1
Management
meeting
02 02/17/2008 Gauss
2 Create budget 02 01/01/2008 Gauss
3
Employee
reviews
01 02/01/2008 Coulomb
4 Produce Report 02 02/01/2008 Gauss
Tankertanker Design
Tankertanker Design
Tankertanker Design
SOLUTION STEPS
UNF 1NF 2NF 3NF
TaskID
TaskDesc
EmpID
DueDate
LastName
TaskID
TaskDesc

TaskID
EmpID
DueDate
LastName

TaskID
TaskDesc

TaskID
EmpID
DueDate

EmpID
LastName
TaskID
TaskDesc

TaskID
EmpID
DueDate

EmpID
LastName

Tankertanker Design
Tankertanker Design
Tankertanker Design
FINAL TABLES
TaskID TaskDesc
1 Management meeting
2 Create budget
3 Employee reviews
4 Produce Report
TaskID EmpID DueDate
1 02 02/17/2008
2 02 01/01/2008
3 01 02/01/2008
4 02 02/01/2008
EmpID LastName
01 Coulomb
02 Gauss
TASK TASK_EMPLOYEE
EMPLOYEE
Tankertanker Design
Tankertanker Design
Tankertanker Design
Normalize the table below:
Std
SSN
Std
City
Std
Class
Offer
No
Off
Term
Off
Year
Enr
Grade
Course
No
Crs
Desc
S1 SEATT
LE
JUN O1 FALL 2006 3.5 C1 DB
S1 SEATT
LE

JUN O2 FALL 2006 3.3 C2 VB
S2 BOTHE
LL
JUN O3 SPRING 2007 3.1 C3 OO
S2 BOTHE
LL

JUN O2 FALL 2006 3.4 C2 VB
Tankertanker Design
Tankertanker Design
Tankertanker Design
SOLUTION STEPS
UNF 1NF 2NF 3NF
StdSSN
StdCity
StdClass
OfferNo
OffTerm
OffYear
EnrGrade
CourseNo
CrsDesc
StdSSN
StdCity
StdClass

StdSSN
OfferNo
OffTerm
OffYear
EnrGrade
CourseNo
CrsDesc

StdSSN
StdCity
StdClass

StdSSN
OfferNo
EnrGrade
CourseNo
CrsDesc

OfferNo
OffTerm
OffYear
StdSSN
StdCity
StdClass

StdSSN
OfferNo
EnrGrade
CourseNo

OfferNo
OffTerm
OffYear

CourseNo
CrsDesc
Tankertanker Design
Tankertanker Design
Tankertanker Design
FINAL TABLES
StdSSN StdCity StdClass
S1 SEATTLE JUN
S2 BOTHELL JUN
StdSSN OfferNo EnrGrade CourseNo

S1 O1 3.5 C1
S1 O2 3.3 C2
S2 O3 3.1 C3
S2 O2 3.4 C2
OfferNo OffTerm OffYear
O1 FALL 2006
O2 FALL 2006
O3 SPRING 2007
CourseNo CrsDesc
C1 DB
C2 VB
C3 OO
STUDENT
OFFER
STUDENT_OFFER
COURSE
Tankertanker Design
Tankertanker Design
Tankertanker Design
Student
_ID
Student_
Name
Subject_
Code
Subject_Name Credit
_
Hours
Grade Address Course Coordinator
S0001 Azlina bt
Ahmad
ACT410
ADM101
ART210
Computerised
Accounting
Graphic Design
4
4
4
A
B
C
Sentul Diploma in
Information
Technology
Fazilah
S0144 Amirul bin
Hamdan
ART310
ART230
BUS210
Graphic
Communication
Business
Organization
4
2
4
A
B
B
Shah
Alam
Diploma in
Computer
Graphic Design
Ahmad
S0151 Mazlina bt
Yakub
ART410
ART 210
BUS210
Promotion Design
Graphic Design
Business
Organisation
4
4
4
C
A
A
Shah
Alam
Associate
Diploma in
Interactive
Multimedia
Sahada
Normalize the tables below from UNF until 3NF
Tankertanker Design
Tankertanker Design
Tankertanker Design
UNF
List all the attributes
UNF 1NF 2NF 3NF
Student_Id
Student_Name
Subject_Code
Subject_Name
Credit_Hours
Grade
Address
Course
Coordinator

Tankertanker Design
Tankertanker Design
Tankertanker Design

1NF
Divide into groups of redundant & irredundant

UNF 1NF 2NF 3NF
Student_Id
Student_Name
Subject_Code
Subject_Name
Credit_Hours
Grade
Address
Course
Coordinator

Student_Id
Student_Name
Grade
Address
Course
Coordinator
Student_Id
Subject_Code
Subject_Name
Credit_Hours

Tankertanker Design
Tankertanker Design
Tankertanker Design
2NF
Identify Functional Dependencies
UNF 1NF 2NF 3NF
Student_Id
Student_Name
Subject_Code
Subject_Name
Credit_Hours
Grade
Address
Course
Coordinator

Student_Id
Student_Name
Grade
Address
Course
Coordinator
Student_Id
Student_Name
Address
Course
Coordinator


Student_Id
Subject_Code
Grade
Student_Id
Subject_Code
Subject_Name
Credit_Hours

Subject_Code
Subject_Name
Credit_Hours

Functional
Dependencies
Tankertanker Design
Tankertanker Design
Tankertanker Design
3NF
Identify Transitive Dependencies
UNF 1NF 2NF 3NF
Student_Id
Student_Name
Subject_Code
Subject_Name
Credit_Hours
Grade
Address
Course
Coordinator

Student_Id
Student_Name
Grade
Address
Course
Coordinator
Student_Id
Student_Name
Address
Course
Coordinator
Student_Id
Student_Name
Address
Course
Student_Id
Subject_Code
Grade

Student_Id
Subject_Code
Grade
Student_Id
Subject_Code
Subject_Name
Credit_Hours

Subject_Code
Subject_Name
Credit_Hours
Subject_Code
Subject_Name
Credit_Hours

Course
Coordinator

Transitive
Dependencies
Tankertanker Design
Tankertanker Design
Tankertanker Design
RESULT AFTER
Student_ID Student_ Name Address Course
S0001 Azlina bt Ahmad Sentul Diploma in
Information
Technology
S0144 Amirul bin
Hamdan
Shah Alam Diploma in
Computer Graphic
Design
S0151 Mazlina bt Yakub Shah Alam Associate Diploma
in Interactive
Multimedia
STUDENT
Tankertanker Design
Tankertanker Design
Tankertanker Design
Student_ID Subject_Code Grade
S0001
S0001
S0001

ACT410
ADM101
ART210
A
B
C
S0144
S0144
S0144
ART310
ART230
BUS210
A
B
B
S0151
S0151
S0151
ART410
ART 210
BUS210
C
A
A
STUDENT_SUBJECT
RESULT AFTER
Tankertanker Design
Tankertanker Design
Tankertanker Design
SUBJECT
RESULT AFTER
Subject_Code Subject_Name Credit_Hours
ACT410
ADM101
ART210
Computerised
Accounting
Graphic Design
4
4
4
ART310
ART230
BUS210
Graphic
Communication
Business
Organization
4
2
4
ART410

Promotion Design 4

Tankertanker Design
Tankertanker Design
Tankertanker Design
Course Coordinator
Diploma in Information
Technology
Fazilah
Diploma in Computer
Graphic Design
Ahmad
Associate Diploma in
Interactive Multimedia
Sahada
COURSE
RESULT AFTER