 Introduction to Functional Dependency
◦ Types of functional Dependency
 Trival Functional Dependency
 Full Functional Dependency
 Partial Functional Dependency
 Transitive Dependency
 Multivated Dependency
 Normalization Process Concepts
o Process of Normalization
◦ Normal Form
 1st Normal Form
 2nd Normal Form
 3rd Normal Form
 Boyce – Code Normal Form (BCNF)
 Functional dependency is a relationship that exists
when one attribute uniquely determines another
attributes. If R is a relation with attributes X and Y,
a functional dependency between the attributes is
represented as X->Y, which specifies Y is
functionally dependent on X.
 The attributes of a table is said to be dependent
on each other when an attribute of a table
uniquely identifies another attributes of the same
table.
 For Example :-
Suppose we have a student table with attributes:
Stu_ID, Stu_Name, Stu_Age.
Here Stu_ID attribute uniquely identifies the
Stu_Name attribute of student table because ID we
can tell the student name associated with it.
Functional dependency and can be written as:
Stu_ID->Stu_Name
We can say Stu_Name is functionally dependent on
Stu_ID.
Formally:
If column A of a table uniquely identifies the column
B of same table then it can represented as A->B (
Attribute B is functionally dependent on Attribute A)
 Trivial Functional Dependency
 Full Functional Dependency
 Partial Functional Dependency
 Transitive Dependency
 Multivalued Dependency
 The dependency of an attribute on a set of
attributes is known as trivial functional
dependency if the set of attributes includes that
attribute.
Symbolically:
 A->B is trivial functional dependency if B is a
subset of A.
 The following dependencies are also trivial: A->A
& B->B
 For Example:
Consider a table with two columns Student_ID and
Student_Name.
{ Student_ID, Student_Name} -> Student_ID is a
trivial functional dependency as Student_ID is a
subset of {Student_ID, Student_Name}.
Also, Student_ID -> Student_ID & Student_Name
-> Student_Name are trivial dependencies too.
 A Functional Dependency X->Y is a full functional
dependency if removal of any attributes A from X
means that the dependency does not hold any
more. That is;
Example
ROLL NO. NAME AGE COURSE
001 ANITA SINGH 16 B.C.A
002 BRIJESH KUMAR 18 B.C.A
003 CHANCHAL RAJ 19 B.C.A
 For any attribute A X, (X-{A}) does not
functionally determine Y.
(X-{A}) Y is called Full Functional
Dependency.

 A Functional Dependency X Y is a partial
dependency if some attribute A X can be
removed from X and then the dependency still
hold.
 That is if for some A X, (X-{A}) Y, then it is
called partial dependency.

 Example
Roll No Course Name Age Address Date of
Completion
001 BBA Rohit Singh 19 MUGHALSARAI 01/10/2018
002 BCA Amit Rai 20 CHETGANJ 25/05/2018
003 B.COM Sushma
Singh
16 LAHURABIR 24/07/2018
004 BSC Priyanka
Soni
20 SIGRA 30/06/2018
 Multivalued dependency occurs when there are
more than one independent multivalued attributes
in a table.
 A Multivalued Dependency is a full constraint
between two sets of attributes in a relation. In
contrast to the functional dependency, the
multivalued dependency requires that certain
tuples be present in a relation.
 Consider a bike manufacture company, which
produce two colors (Black and white) in each
model every year.
Bike Model Manufacture
Year
Color
M101 2016 BLACK
M102 2016 WHITE
M103 2017 BLACK
M104 2017 BLACK
M105 2017 WHITE
M106 2018 BLACK
 Here columns manuf_year and color are
independent of each other and dependent on
bike_model. In this case these two columns are
said to be multivalued dependent on bike_model.
 These dependencies can be represented like this:
 Bike_model ->> manuf_year
 Bike_model ->>color
 A functional dependency is said to be transitive if it
is indirectly formed by two functional
dependencies.
X->Z is a transitive dependency if the following
three functional dependencies hold true:
• X->Y
• Y does not -> X
• Y->Z
A transitive dependency can only occur in a relation
of three of more attributes. This dependency helps
us normalizing the database in 3NF (3rd Normal
Form).
 Example:-
Book Author Author age
Games of Thrones George R.R Martin 66
Harry Potter J.K. Rowling 49
Dying of the Light George R.R Martin 68
 {Book}->{Author} (if we know the book, we
knows the author name)
 {Author} does not->{Book}
 {Author} ->{Author_age}
 Therefore as per the rule of transitive
dependency.
 {Book}->{Author_age} should hold, that makes
sense because if we know the book name we can
know the author’s age.
 Main objective in developing a logical data model
for relational database systems is to create an
accurate representation of the data, its
relationships, and constraints.
 To achieve this objective, must identify a suitable
set of relations.
 Four most commonly used normal forms are
first(1NF), second(2NF), and third(3NF) normal
form, and Boyce-Cold Normal Form(BCNF).
 Based on Functional Dependencies among the
attributes of a relation.
 A relation can be normalized to a specific form to
prevent possible occurrence of update anomalies.
 Formal technique for analyzing a relation based
on its primary key and functional dependencies
between its attributes.
 Often executed as a series of steps. Each step
corresponds to a specific normal form, which has
known properties.
 As normalization proceeds, relations become
progressively more restricted (stronger) in format
and also less vulnerable to update anomalies.
 Difference between Different forms of
Normalizations.
1. First Normal Form (1NF).
2. Second Normal Form (2NF).
3. Third Normal Form (3NF).
4. Boyce – Codd Normal Form (BCNF).
 Eliminate repeating groups in individual tables.
 Create a separate table for each set of related
data.
 Identify each set of related data with a primary
key.
 First Normal Form : No Repeating Groups
 The above relation is not in 1NF because there
are multiple values in color field.
Item Colors Price Tax
T-shirt Red , Blue 12.00 0.60
Polo Red , Yellow 12.00 0.60
Sweatshirt Blue , Black 25.00 1.25
 After Converting it to 1NF it will look like:
Item Color Price Tax
T-shirt Red 12.00 0.60
T-shirt Blue 12.00 0.60
Polo Red 12.00 0.60
Polo Yellow 12.00 0.60
Sweatshirt Blue 25.00 1.25
Sweatshirt Black 25.00 1.25
 Create separate tables for sets of values that apply to
multiple records.
 Relate these tables with a foreign key.
 All non-key fields depend on all components of the
primary key. (Guaranteed when primary key is single
Field).
 Records should not depend on anything other than a
table’s primary key (a compound key, if necessary).
 Example
 Table is not in Second Normal form because price
and tax depend on item, but not color.
Item Color Price Tax
T-shirt Red 12.00 0.60
T-shirt Blue 12.00 0.60
Polo Red 12.00 0.60
Polo Yellow 12.00 0.60
Sweatshirt Blue 25.00 1.25
Sweatshirt Black 25.00 1.25
Item Color
T-shirt Red
T-shirt Blue
Polo Red
Polo Yellow
Sweatshirt Blue
Sweatshirt Black
Item Price Tax
T-shirt 12.00 0.60
Polo 12.00 0.60
Sweatshirt 25.00 1.25
 Eliminate fields that do not depend on the key.
 Third Normal Form Prohibits transitive
dependencies
.
 No non-key field depends upon another. (All non-
key fields depends only on the primary key).
 A transitive dependency exist when any attribute in
a table is dependent of any other non – key attribute
in that table.
 Tables are not in Third Normal Form because tax
depends on price, not item.
Item Color
T-Shirt Red
T-Shirt Blue
Polo Red
Polo Yellow
SweatShirt Blue
SweatShirt Black
Item Price Tax
T-Shirt 12.00 0.60
Polo 12.00 0.60
SweatShirt 25.00 1.25
Item Color
T-Shirt Red
T-Shirt Blue
Polo Red
Polo Yellow
SweatShirt Blue
SweatShirt Black
Item Price
T-Shirt 12.00
Polo 12.00
SweatShirt 25.00
Price Tax
12.00 0.60
25.00 1.25
 Based on Functional Dependencies that take into
account all candidate keys in a relation, However
BCNF also has additional constraints compared with
general definition of 3NF.
 BCNF – A relation is in BCNF if and only if every
determinants is a candidate key.
 Difference between 3NF and BCNF is that for a
functional Dependency A B, 3NF allows this
dependency in a relation if B is a primary key attribute
and A is not a Candidate Key.
Patient
No.
Patient
Name
Appointment
ID
Time Doctor
1 Sunita 0 12:00 Radhika
2 Supriya 0 12:50 Ishita
3 Sanjana 1 13:30 Smita
4 Sandhya 0 14:40 Shreya
5 Sugandha 1 15:30 Priyanka
 Sanjay Kaushik, Manoj Kumar “Introduction to
DBMS”— 2015-2016
 Anju Edadan “Developer at Qburst Technologies”
 Jargalsaikhan Alyeksandar “Technical System
Analyst”
Data base management system (2)

Data base management system (2)

  • 2.
     Introduction toFunctional Dependency ◦ Types of functional Dependency  Trival Functional Dependency  Full Functional Dependency  Partial Functional Dependency  Transitive Dependency  Multivated Dependency  Normalization Process Concepts o Process of Normalization ◦ Normal Form  1st Normal Form  2nd Normal Form  3rd Normal Form  Boyce – Code Normal Form (BCNF)
  • 3.
     Functional dependencyis a relationship that exists when one attribute uniquely determines another attributes. If R is a relation with attributes X and Y, a functional dependency between the attributes is represented as X->Y, which specifies Y is functionally dependent on X.  The attributes of a table is said to be dependent on each other when an attribute of a table uniquely identifies another attributes of the same table.
  • 4.
     For Example:- Suppose we have a student table with attributes: Stu_ID, Stu_Name, Stu_Age. Here Stu_ID attribute uniquely identifies the Stu_Name attribute of student table because ID we can tell the student name associated with it.
  • 5.
    Functional dependency andcan be written as: Stu_ID->Stu_Name We can say Stu_Name is functionally dependent on Stu_ID. Formally: If column A of a table uniquely identifies the column B of same table then it can represented as A->B ( Attribute B is functionally dependent on Attribute A)
  • 6.
     Trivial FunctionalDependency  Full Functional Dependency  Partial Functional Dependency  Transitive Dependency  Multivalued Dependency
  • 7.
     The dependencyof an attribute on a set of attributes is known as trivial functional dependency if the set of attributes includes that attribute. Symbolically:  A->B is trivial functional dependency if B is a subset of A.  The following dependencies are also trivial: A->A & B->B
  • 8.
     For Example: Considera table with two columns Student_ID and Student_Name. { Student_ID, Student_Name} -> Student_ID is a trivial functional dependency as Student_ID is a subset of {Student_ID, Student_Name}. Also, Student_ID -> Student_ID & Student_Name -> Student_Name are trivial dependencies too.
  • 9.
     A FunctionalDependency X->Y is a full functional dependency if removal of any attributes A from X means that the dependency does not hold any more. That is; Example ROLL NO. NAME AGE COURSE 001 ANITA SINGH 16 B.C.A 002 BRIJESH KUMAR 18 B.C.A 003 CHANCHAL RAJ 19 B.C.A
  • 10.
     For anyattribute A X, (X-{A}) does not functionally determine Y. (X-{A}) Y is called Full Functional Dependency. 
  • 11.
     A FunctionalDependency X Y is a partial dependency if some attribute A X can be removed from X and then the dependency still hold.  That is if for some A X, (X-{A}) Y, then it is called partial dependency. 
  • 12.
     Example Roll NoCourse Name Age Address Date of Completion 001 BBA Rohit Singh 19 MUGHALSARAI 01/10/2018 002 BCA Amit Rai 20 CHETGANJ 25/05/2018 003 B.COM Sushma Singh 16 LAHURABIR 24/07/2018 004 BSC Priyanka Soni 20 SIGRA 30/06/2018
  • 13.
     Multivalued dependencyoccurs when there are more than one independent multivalued attributes in a table.  A Multivalued Dependency is a full constraint between two sets of attributes in a relation. In contrast to the functional dependency, the multivalued dependency requires that certain tuples be present in a relation.
  • 14.
     Consider abike manufacture company, which produce two colors (Black and white) in each model every year. Bike Model Manufacture Year Color M101 2016 BLACK M102 2016 WHITE M103 2017 BLACK M104 2017 BLACK M105 2017 WHITE M106 2018 BLACK
  • 15.
     Here columnsmanuf_year and color are independent of each other and dependent on bike_model. In this case these two columns are said to be multivalued dependent on bike_model.  These dependencies can be represented like this:  Bike_model ->> manuf_year  Bike_model ->>color
  • 16.
     A functionaldependency is said to be transitive if it is indirectly formed by two functional dependencies. X->Z is a transitive dependency if the following three functional dependencies hold true: • X->Y • Y does not -> X • Y->Z A transitive dependency can only occur in a relation of three of more attributes. This dependency helps us normalizing the database in 3NF (3rd Normal Form).
  • 17.
     Example:- Book AuthorAuthor age Games of Thrones George R.R Martin 66 Harry Potter J.K. Rowling 49 Dying of the Light George R.R Martin 68
  • 18.
     {Book}->{Author} (ifwe know the book, we knows the author name)  {Author} does not->{Book}  {Author} ->{Author_age}  Therefore as per the rule of transitive dependency.  {Book}->{Author_age} should hold, that makes sense because if we know the book name we can know the author’s age.
  • 19.
     Main objectivein developing a logical data model for relational database systems is to create an accurate representation of the data, its relationships, and constraints.  To achieve this objective, must identify a suitable set of relations.  Four most commonly used normal forms are first(1NF), second(2NF), and third(3NF) normal form, and Boyce-Cold Normal Form(BCNF).
  • 20.
     Based onFunctional Dependencies among the attributes of a relation.  A relation can be normalized to a specific form to prevent possible occurrence of update anomalies.
  • 21.
     Formal techniquefor analyzing a relation based on its primary key and functional dependencies between its attributes.  Often executed as a series of steps. Each step corresponds to a specific normal form, which has known properties.  As normalization proceeds, relations become progressively more restricted (stronger) in format and also less vulnerable to update anomalies.
  • 22.
     Difference betweenDifferent forms of Normalizations.
  • 23.
    1. First NormalForm (1NF). 2. Second Normal Form (2NF). 3. Third Normal Form (3NF). 4. Boyce – Codd Normal Form (BCNF).
  • 24.
     Eliminate repeatinggroups in individual tables.  Create a separate table for each set of related data.  Identify each set of related data with a primary key.
  • 25.
     First NormalForm : No Repeating Groups  The above relation is not in 1NF because there are multiple values in color field. Item Colors Price Tax T-shirt Red , Blue 12.00 0.60 Polo Red , Yellow 12.00 0.60 Sweatshirt Blue , Black 25.00 1.25
  • 26.
     After Convertingit to 1NF it will look like: Item Color Price Tax T-shirt Red 12.00 0.60 T-shirt Blue 12.00 0.60 Polo Red 12.00 0.60 Polo Yellow 12.00 0.60 Sweatshirt Blue 25.00 1.25 Sweatshirt Black 25.00 1.25
  • 27.
     Create separatetables for sets of values that apply to multiple records.  Relate these tables with a foreign key.  All non-key fields depend on all components of the primary key. (Guaranteed when primary key is single Field).  Records should not depend on anything other than a table’s primary key (a compound key, if necessary).
  • 28.
     Example  Tableis not in Second Normal form because price and tax depend on item, but not color. Item Color Price Tax T-shirt Red 12.00 0.60 T-shirt Blue 12.00 0.60 Polo Red 12.00 0.60 Polo Yellow 12.00 0.60 Sweatshirt Blue 25.00 1.25 Sweatshirt Black 25.00 1.25
  • 29.
    Item Color T-shirt Red T-shirtBlue Polo Red Polo Yellow Sweatshirt Blue Sweatshirt Black Item Price Tax T-shirt 12.00 0.60 Polo 12.00 0.60 Sweatshirt 25.00 1.25
  • 30.
     Eliminate fieldsthat do not depend on the key.  Third Normal Form Prohibits transitive dependencies .  No non-key field depends upon another. (All non- key fields depends only on the primary key).  A transitive dependency exist when any attribute in a table is dependent of any other non – key attribute in that table.
  • 31.
     Tables arenot in Third Normal Form because tax depends on price, not item. Item Color T-Shirt Red T-Shirt Blue Polo Red Polo Yellow SweatShirt Blue SweatShirt Black Item Price Tax T-Shirt 12.00 0.60 Polo 12.00 0.60 SweatShirt 25.00 1.25
  • 32.
    Item Color T-Shirt Red T-ShirtBlue Polo Red Polo Yellow SweatShirt Blue SweatShirt Black Item Price T-Shirt 12.00 Polo 12.00 SweatShirt 25.00 Price Tax 12.00 0.60 25.00 1.25
  • 33.
     Based onFunctional Dependencies that take into account all candidate keys in a relation, However BCNF also has additional constraints compared with general definition of 3NF.  BCNF – A relation is in BCNF if and only if every determinants is a candidate key.  Difference between 3NF and BCNF is that for a functional Dependency A B, 3NF allows this dependency in a relation if B is a primary key attribute and A is not a Candidate Key.
  • 34.
    Patient No. Patient Name Appointment ID Time Doctor 1 Sunita0 12:00 Radhika 2 Supriya 0 12:50 Ishita 3 Sanjana 1 13:30 Smita 4 Sandhya 0 14:40 Shreya 5 Sugandha 1 15:30 Priyanka
  • 35.
     Sanjay Kaushik,Manoj Kumar “Introduction to DBMS”— 2015-2016  Anju Edadan “Developer at Qburst Technologies”  Jargalsaikhan Alyeksandar “Technical System Analyst”