0% found this document useful (0 votes)
29 views

DBS Lecture 11

This document discusses advance normal forms in database design, including Boyce-Codd normal form (BCNF), fourth normal form (4NF), and fifth normal form (5NF). It provides examples of relations that violate BCNF and 4NF and how to convert them to be in the proper normal form. Merging relations from different data models is also covered, noting issues like synonyms, homonyms, transitive dependencies, and hidden supertype/subtype relationships.

Uploaded by

aliammad351
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

DBS Lecture 11

This document discusses advance normal forms in database design, including Boyce-Codd normal form (BCNF), fourth normal form (4NF), and fifth normal form (5NF). It provides examples of relations that violate BCNF and 4NF and how to convert them to be in the proper normal form. Merging relations from different data models is also covered, noting issues like synonyms, homonyms, transitive dependencies, and hidden supertype/subtype relationships.

Uploaded by

aliammad351
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

MIRPUR UNIVERSITY OF SCIENCE AND TECHNOLOGY

DEPARMENT OF SOFTWARE ENGINEERING


DATABASE SYSTEMS
(Lecture # 11)
Advance Normal Forms

Engr. Samiullah Khan


(Lecturer)
LECTURE CONTENTS

1. Advance Normal Forms

2. Boyce-Codd Normal Form

3. Fourth Normal Form

4. Fifth Normal Form

Database Systems 3
Chapter 4:
Logical Database Design
and the Relational Model
Modern Database Management
12th Edition
Jeffrey A. Hoffer, Mary B. Prescott,
Fred R. McFadden
Advance Normal Forms

1. Boyce-Codd Normal Form

2. Fourth Normal Form

3. Fifth Normal Form

Database Systems 5
Boyce-Codd Normal Form

Boyce-Codd Normal Form is violated if:

• Third Normal Form is violated


• If there exists a partial key which is functionally dependent
on a non-key field(s).
non-key partial-key

Database Systems 6
BCNF Example
• A student can have more than one major
• A student has a different advisor for each major
• Each advisor advises for only one major

Database Systems 7
BCNF Description
• Primary Key for this relation is composite key consisting of SID and Major
• Thus, two attributes Advisor and MajGPA are functionally dependent on this
primary key
• There exist another functional dependence i.e. Major (a key attribute) is
functionally dependent on Advisor (non-key attribute)
• That is, each advisor advises in exactly one major
• Notice that it is not a Transitive Dependency

• Is the above relation in 3rd Normal Form?

Database Systems 8
Definition of BCNF

• A relation is in BCNF if and only if every determinant


in the relation is Candidate Key
• STUDENT_ADVISOR relation is not in BCNF
because although the attribute Advisor is a
determinant, it is not a candidate key
• Only Major is functionally dependent on Advisor

Database Systems 9
Converting a Relation to BCNF

Database Systems 10
Converting a Relation to BCNF

11
Fourth Normal Form – 4NF
4th Normal Form is violated if:
• Boyce Codd Normal Form is violated
• If there exists a partial key which has multiple independent
multi-valued functional dependencies to other partial keys
partial-key1 partial-key2
partial-key3
• Multi-valued Dependency exists when there are at
least 3 attributes (e.g, A, B and C) in a relation, and for
each value of A there is a set of values of B and a set
of values of C

Database Systems 12
Example 1 – 4NF

Instruments_Languages

Name Instrument Language


Fred Piano French
Fred Flute Italian
Fred Flute Spanish
Jane Piano French
Jane Oboe French
Sam Piano French
Sam Oboe Spanish
Sam Flute Spanish

Database Systems 13
4NF Example – Violation

Name Instrument Language


Fred Piano French
Fred Flute Italian
Fred Flute Spanish
Jane Piano French
Jane Oboe French
Sam Piano French
Sam Oboe Spanish
Sam Flute Spanish

Does this relation violate 1st, 2nd, 3rd, or BCNF?

Database Systems 14
4NF Example – Correction

Database Systems 15
Example 2 – 4NF

Database Systems 16
Example 2 – 4NF

17
5NF

• It deals with property called “Lossless joins”


• 5NF is not of practical significance because lossless joins occurs very
rarely and are difficult to detect
• For this reason (and also because 5NF has a complex definition), we
do not describe 5NF in this text

• For detail visit


http://ecomputernotes.com/database-system/rdbms/fifth-normal-form

Database Systems 18
Domain Key Normal Form (DKNF)

• It takes into account all possible types of dependencies


and constraints
• Although the definition of DKNF is quite simple, its
practical value is minimal

Database Systems 19
Merging Relations
• View Integration – Merging relations (also called view integration)
is combining entities from multiple ER models into common
relations

• Issues to watch out for when merging entities from different ER


models:
• Synonyms–Two or more attributes with different names but same meaning
i.e. Employee_ID and Employee_No

• Homonyms–Attributes with same name but different meanings i.e. Address is


converted to HomeAdd and OffAdd

• STUDENT(StudentID, Name, PhoneNo, CampusAddress, PermanentAddress)

Database Systems 20
Merging Relations

Database Systems 21
Merging Relations
• Transitive dependencies –Even if relations are in 3NF prior to
merging, they may become in 2NF due to transitive dependencies
between non-key attributes

• STUDENT1(StudentID, MajorName)
STUDENT2(StudentID, Advisor)

Database Systems 22
Merging Relations
• Super-type/subtype relationships –These relationships may be
hidden prior to merging i.e. Patient-> ResPatient and OutPatient

Database Systems 23
THANKS

You might also like