What is Functional Dependency in DBMS UNIT 3
What is Functional Dependency in DBMS UNIT 3
Example:
A B
1 3
2 3
4 0
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.
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:
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
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.
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
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.