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

What is Functional Dependency in DBMS UNIT 3

Functional dependency in DBMS describes the relationship between attributes in a table, indicating that the value of one attribute determines another. It is crucial for maintaining data quality and can be represented in various forms, including trivial, non-trivial, and multivalued dependencies. Additionally, normalization is a process that organizes database attributes to reduce redundancy and improve efficiency, ensuring data consistency and accuracy.

Uploaded by

Vaishnavi Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

What is Functional Dependency in DBMS UNIT 3

Functional dependency in DBMS describes the relationship between attributes in a table, indicating that the value of one attribute determines another. It is crucial for maintaining data quality and can be represented in various forms, including trivial, non-trivial, and multivalued dependencies. Additionally, normalization is a process that organizes database attributes to reduce redundancy and improve efficiency, ensuring data consistency and accuracy.

Uploaded by

Vaishnavi Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

UNIT 3

What is Functional Dependency in DBMS?


Functional dependency in DBMS is an important concept that describes the relationship


between attributes (columns) in a table. It shows that the value of one attribute determines the
other. In this article, we will learn about functional dependencies and their types. Functional
dependencies help maintain the quality of data in the database.
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 if we know the
student id we can tell the student name associated with it. This is known as functional
dependency and can be written as Stu_Id→Stu_Name or in words 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).

Example:
A B

1 3

2 3

4 0

How to represent functional dependency in DBMS?


Functional dependency is expressed in the form of equations. For example, if we have an
employee record with fields "EmployeeID", "FirstName" and "LastName" we can specify the
function as follows:
EmployeeID -> FirstName, LastName
To represent functional dependency in DBMS has two main features: left (LHS) and right
(RHS) of the arrow (->).
For example, if we have a table with attributes "X", "Y" and "Z" and the attribute "X" can
determine the value of the attributes "Y" and "Z".
X -> Y, Z
This symbol indicates that the value in property "X" determines the values in property "Y" and
"Z". So if you know the value of "X", you can also determine the value of "Y" and "Z".
Example:
roll_no name dept_namedept_building

42 abc CO A4

43 pqr IT A3

44 xyz CO A4

45 xyz IT A3

46 mno EC B2

47 jkl ME B2

From the above table we can conclude some valid functional dependencies:
 roll_no → { name, dept_name, dept_building }→ Here, roll_no can determine values of
fields name, dept_name and dept_building, hence a valid Functional dependency
 roll_no → dept_name , Since, roll_no can determine whole set of {name, dept_name,
dept_building}, it can determine its subset dept_name also.
 dept_name → dept_building , Dept_name can identify the dept_building accurately, since
departments with different dept_name will also have a different dept_building
 More valid functional dependencies: roll_no → name, {roll_no, name} ⇢ {dept_name,
dept_building}, etc.
Here are some invalid functional dependencies:
 name → dept_name Students with the same name can have different dept_name, hence
this is not a valid functional dependency.
 dept_building → dept_name There can be multiple departments in the same building.
Example, in the above table departments ME and EC are in the same building B2, hence
dept_building → dept_name is an invalid functional dependency.
 More invalid functional dependencies: name → roll_no, {name, dept_name} → roll_no,
dept_building → roll_no, etc.
Read more about What is Functional Dependency in DBMS ?
Types of Functional Dependencies in DBMS
1. Trivial functional dependency
2. Non-Trivial functional dependency
3. Multivalued functional dependency
4. Transitive functional dependency
1. Trivial Functional Dependency
In Trivial Functional Dependency, a dependent is always a subset of the determinant. i.e. If X
→ Y and Y is the subset of X, then it is called trivial functional dependency.

Symbolically: A→B is trivial functional dependency if B is a subset of A.


The following dependencies are also trivial: A→A & B→B
Example 1 :
 ABC -> AB
 ABC -> A
 ABC -> ABC
Example 2:
roll_no name age

42 abc 17

43 pqr 18

44 xyz 18

Here, {roll_no, name} → name is a trivial functional dependency, since the dependent name is
a subset of determinant set {roll_no, name}. Similarly, roll_no → roll_no is also an example of
trivial functional dependency.
2. Non-trivial Functional Dependency
In Non-trivial functional dependency, the dependent is strictly not a subset of the
determinant. i.e. If X → Y and Y is not a subset of X, then it is called Non-trivial functional
dependency.
Example 1 :
 Id -> Name
 Name -> DOB
Example 2:
roll_no name age

42 abc 17
roll_no name age

43 pqr 18

44 xyz 18

Here, roll_no → name is a non-trivial functional dependency, since the dependent name is not
a subset of determinant roll_no. Similarly, {roll_no, name} → age is also a non-trivial
functional dependency, since age is not a subset of {roll_no, name}
3. Semi Non Trivial Functional Dependencies
A semi non-trivial functional dependency occurs when part of the dependent attribute (right-
hand side) is included in the determinant (left-hand side), but not all of it. This is a middle
ground between trivial and non-trivial functional dependencies. X -> Y is called semi non-
trivial when X intersect Y is not NULL.
Example:

Consider the following table:


Student_ID Course_ID Course_Name

101 CSE101 Computer Science

102 CSE102 Data Structures

103 CSE101 Computer Science

Functional Dependency:
{StudentID,CourseID}→CourseID
This is semi non-trivial because:
 Part of the dependent attribute (Course_ID) is already included in the determinant
({Student_ID, Course_ID}).
 However, the dependency is not completely trivial because {StudentID}→CourseID is not
implied directly.
4. Multivalued Functional Dependency
In Multivalued functional dependency, entities of the dependent set are not dependent on each
other. i.e. If a → {b, c} and there exists no functional dependency between b and c, then it is
called a multivalued functional dependency.
Example:
bike_model manuf_year color

tu1001 2007 Black

tu1001 2007 Red

tu2012 2008 Black

tu2012 2008 Red

tu2222 2009 Black

tu2222 2009 Red


In this table:
 X: bike_model
 Y: color
 Z: manuf_year
For each bike model (bike_model):
1. There is a group of colors (color) and a group of manufacturing years (manuf_year).
2. The colors do not depend on the manufacturing year, and the manufacturing year does not
depend on the colors. They are independent.
3. The sets of color and manuf_year are linked only to bike_model.
That’s what makes it a multivalued dependency.
In this case these two columns are said to be multivalued dependent on bike_model. These
dependencies can be represented like this:
5. Transitive Functional Dependency
In transitive functional dependency, dependent is indirectly dependent on determinant. i.e. If a
→ b & b → c, then according to axiom of transitivity, a → c. This is a transitive functional
dependency.
Example:
enrol_no name dept building_no

42 abc CO 4

43 pqr EC 2

44 xyz IT 1
enrol_no name dept building_no

45 abc EC 2

Here, enrol_no → dept and dept → building_no. Hence, according to the axiom of transitivity,
enrol_no → building_no is a valid functional dependency. This is an indirect functional
dependency, hence called Transitive functional dependency.
6. Fully Functional Dependency
In full functional dependency an attribute or a set of attributes uniquely determines another
attribute or set of attributes. If a relation R has attributes X, Y, Z with the dependencies X->Y
and X->Z which states that those dependencies are fully functional.
Read more about Fully Functional Dependency.
7. Partial Functional Dependency
In partial functional dependency a non key attribute depends on a part of the composite key,
rather than the whole key. If a relation R has attributes X, Y, Z where X and Y are the
composite key and Z is non key attribute. Then X->Z is a partial functional dependency in
RBDMS.
Read more about Partial Dependency.
Conclusion
Functional dependency is very important concept in database management system for ensuring
the data consistency and accuracy. In this article we have discuss what is the concept behind
functional dependencies and why they are important. The valid and invalid functional
dependencies and the types of most important functional dependencies in RDBMS. We have
also discussed about the advantages of FDs.

Armstrong’s Axioms in Functional Dependency


Reflexivity: If A is a set of attributes and B is a part of A, then the function A -> B is valid.
Augmentation: If the A -> B dependency is valid, adding multiple elements to either side of
the dependency will not affect the dependency.
Transitivity: If the functions X → Y and Y → Z are both valid, then X → Z is also valid
according to the transitivity rule.
Benefits of Functional Dependency in DBMS
Functional dependency in a database management system offers several advantages for
businesses and organizations:
 Prevents Duplicate Data:
Functional dependency helps avoid storing the same data repeatedly in the database,
reducing redundancy and saving storage space.
 Improves Data Quality and Accuracy:
By organizing data efficiently and minimizing duplication, functional dependency ensures
the data is reliable, consistent, and of high quality.
 Reduces Errors:
Keeping data organized and concise lowers the chances of errors in records or datasets,
making it easier to manage and update information.
 Saves Time and Costs:
Properly organized data allows for quicker and easier access, improving productivity and
reducing the time and cost of managing information.
 Defines Rules and Behaviors:
Functional dependency allows setting rules and constraints that control how data is stored,
accessed, and maintained, ensuring better data management.
 Helps Identify Poor Database Design:
It highlights issues like scattered or missing data across tables, helping identify and fix
design flaws to maintain consistency and integrity.
Conclusion
Functional dependencies define how things are related to each other. It helps maintain the
quality of the information in the database. It is represented by an arrow. Analyzing these
relationships can simplify data creation, reduce complexity, and improve query performance.
These are the building blocks for managing processes and reliable databases that are important
for modern data management and data access.
Introduction of Database Normalization
Normalization is an important process in database design that helps improve the database's
efficiency, consistency, and accuracy. It makes it easier to manage and maintain the data and
ensures that the database is adaptable to changing business needs.
 Database normalization is the process of organizing the attributes of the database to reduce or
eliminate data redundancy (having the same data but at different places).
 Data redundancy unnecessarily increases the size of the database as the same data is repeated
in many places. Inconsistency problems also arise during insert, delete, and update
operations.
 In the relational model, there exist standard methods to quantify how efficient a databases is.
These methods are called normal forms and there are algorithms to covert a given database
into normal forms.
 Normalization generally involves splitting a table into multiple ones which must be linked
each time a query is made requiring data from the split tables.
Why do we need Normalization?
The primary objective for normalizing the relations is to eliminate the below anomalies. Failure
to reduce anomalies results in data redundancy, which may threaten data integrity and cause
additional issues as the database increases. Normalization consists of a set of procedures that
assist you in developing an effective database structure.
 Insertion Anomalies: Insertion anomalies occur when it is not possible to insert data into a
database because the required fields are missing or because the data is incomplete. For
example, if a database requires that every record has a primary key, but no value is provided
for a particular record, it cannot be inserted into the database.
 Deletion anomalies: Deletion anomalies occur when deleting a record from a database and
can result in the unintentional loss of data. For example, if a database contains information
about customers and orders, deleting a customer record may also delete all the orders
associated with that customer.
 Updation anomalies: Updation anomalies occur when modifying data in a database and can
result in inconsistencies or errors. For example, if a database contains information about
employees and their salaries, updating an employee’s salary in one record but not in all
related records could lead to incorrect calculations and reporting.
Before Normalization: The table is prone to redundancy and anomalies (insertion, update, and
deletion).
After Normalization: The data is divided into logical tables to ensure consistency, avoid
redundancy and remove anomalies making the database efficient and reliable.

Features of Database Normalization


 Elimination of Data Redundancy: One of the main features of normalization is to
eliminate the data redundancy that can occur in a database. Data redundancy refers to the
repetition of data in different parts of the database. Normalization helps in reducing or
eliminating this redundancy, which can improve the efficiency and consistency of the
database.
 Ensuring Data Consistency: Normalization helps in ensuring that the data in the database
is consistent and accurate. By eliminating redundancy, normalization helps in preventing
inconsistencies and contradictions that can arise due to different versions of the same data.
 Simplification of Data Management: Normalization simplifies the process of managing
data in a database. By breaking down a complex data structure into simpler tables,
normalization makes it easier to manage the data, update it, and retrieve it.
 Improved Database Design: Normalization helps in improving the overall design of the
database. By organizing the data in a structured and systematic way, normalization makes it
easier to design and maintain the database. It also makes the database more flexible and
adaptable to changing business needs.
 Avoiding Update Anomalies: Normalization helps in avoiding update anomalies, which
can occur when updating a single record in a table affects multiple records in other tables.
Normalization ensures that each table contains only one type of data and that the
relationships between the tables are clearly defined, which helps in avoiding such
anomalies.
 Standardization: Normalization helps in standardizing the data in the database. By
organizing the data into tables and defining relationships between them, normalization
helps in ensuring that the data is stored in a consistent and uniform manner.
Normal Forms in DBMS
Normal Forms Description of Normal Forms

First Normal A relation is in first normal form if every attribute in that relation is single-
Form (1NF) valued attribute.

Second A relation that is in First Normal Form and every non-primary-key attribute
Normal Form is fully functionally dependent on the primary key, then the relation is
(2NF) in Second Normal Form (2NF).

Third Normal A relation is in the third normal form, if there is no transitive dependency for
Form (3NF) non-prime attributes as well as it is in the second normal form. A relation is
in 3NF if at least one of the following conditions holds in every non-trivial
function dependency X –> Y.
 X is a super key.
Normal Forms Description of Normal Forms

 Y is a prime attribute (each element of Y is part of some candidate key).

For BCNF the relation should satisfy the below conditions


Boyce-Codd  The relation should be in the 3rd Normal Form.
Normal Form  X should be a super-key for every functional dependency (FD) X−>Y in a
(BCNF) given relation.

Fourth A relation R is in 4NF if and only if the following conditions are satisfied:
Normal Form  It should be in the Boyce-Codd Normal Form (BCNF) .
(4NF)  The table should not have any Multi-valued Dependency.

Advantages of Normalization
 Normalization eliminates data redundancy and ensures that each piece of data is stored in
only one place, reducing the risk of data inconsistency and making it easier to maintain data
accuracy.
 By breaking down data into smaller, more specific tables, normalization helps ensure that
each table stores only relevant data, which improves the overall data integrity of the
database.
 Normalization simplifies the process of updating data, as it only needs to be changed in one
place rather than in multiple places throughout the database.
 Normalization enables users to query the database using a variety of different criteria, as
the data is organized into smaller, more specific tables that can be joined together as
needed.
 Normalization can help ensure that data is consistent across different applications that use
the same database, making it easier to integrate different applications and ensuring that all
users have access to accurate and consistent data.
Disadvantages of Normalization
 Normalization can result in increased performance overhead due to the need for
additional join operations and the potential for slower query execution times.
 Normalization can result in the loss of data context, as data may be split across multiple
tables and require additional joins to retrieve.
 Proper implementation of normalization requires expert knowledge of database design and
the normalization process.
 Normalization can increase the complexity of a database design, especially if the data
model is not well understood or if the normalization process is not carried out correctly.
Conclusion
Database normalization is a key concept in organizing data efficiently within a database. By
reducing redundancy, ensuring data consistency, and breaking data into well-structured tables,
normalization enhances the accuracy, scalability, and maintainability of a database. It
simplifies data updates, improves integrity, and supports flexible querying, making it an
essential practice for designing reliable and efficient database systems.

You might also like