Skip to main content Skip to footer
Project management

Types of Functional Dependencies in DBMS + 4 Examples [2024]

monday.com 7 min read
Get Started

Functional dependencies are a fundamental concept in database design, and are used to establish relationships between attributes in a database. They are used to ensure that the database is in a state of normalization, which helps to minimize data redundancy and improve data integrity.

What are functional dependencies?

A functional dependency is a relationship between two sets of attributes in a database, where one set (the determinant) determines the values of the other set (the dependent). For example, in a database of employees, the employee ID number (determinant) would determine the employee’s name, address, and other personal information (dependent). This means that, given an employee ID number, we can determine the corresponding employee’s name and other personal information, but not vice versa.

Functional dependencies can also be represented using mathematical notation. For example, the functional dependency above can be represented as:

Employee ID → Employee Name, Address, etc.

It’s important to note that functional dependencies only apply to the individual tuples in the table, and not to the table as a whole.

What can functional dependencies be used for?

There are a few ways you could use functional dependencies in your database management.

Identify and eliminate data redundancy in a database

For example, if a database contains a table with the attributes “employee ID” and “employee name”, and another table with the attributes “employee ID” and “employee address”, then there is a functional dependency between “employee ID” and “employee name” in the first table, and between “employee ID” and “employee address” in the second table.

By combining these two tables into one, with the attributes “employee ID”, “employee name”, and “employee address”, the data redundancy is eliminated.

Identify and eliminate data inconsistencies in a database

For example, if a database contains a table with the attributes “employee ID” and “employee name”, and another table with the attributes “employee ID” and “employee address”, then there is a functional dependency between “employee ID” and “employee name” in the first table, and between “employee ID” and “employee address” in the second table. If the employee’s name is changed in the first table, but not in the second table, then the data is inconsistent.

By combining these two tables into one, with the attributes “employee ID”, “employee name”, and “employee address”, the data inconsistencies are eliminated.

What are the different types of functional dependencies?

There are several types of functional dependencies, including full functional dependencies, partial functional dependencies, and transitive functional dependencies.

Full functional dependency

A full functional dependency is a type of functional dependency where the dependent attributes are determined by the determinant attributes. For example, in the database of employees, the employee ID number fully determines the employee’s name, address, and other personal information.

Partial functional dependency

A partial dependency is a functional dependency where the dependent attributes are partially determined by the determinant attributes. For example, in a database of employees, the employee ID number may partially determine the employee’s address, but not the employee’s name or other personal information.

Transitive functional dependency

A transitive functional dependency is a functional dependency where the dependent attributes are determined by a set of attributes that are not included in the determinant attributes. For example, in a database of employees, the employee ID number may determine the employee’s department, which in turn determines the employee’s salary.

Trivial functional dependency

A trivial functional dependency in a relational database happens when an attribute or a set of attributes uniquely determines itself or a part of itself. For example, if A leads to A or A, B leads to A, these are trivial dependencies. These always hold true and help to identify more meaningful, non-trivial dependencies in database organization.

Non-trivial functional dependency

A non-trivial functional dependency in a relational database occurs when an attribute or set of attributes uniquely determines another attribute or set that is not included in the original attributes. Simply put, if A determines B, and B is not part of A, this is a non-trivial dependency. These dependencies highlight important relationships between attributes and are essential for organizing and maintaining the integrity of a database.

Examples of functional dependencies

Functional dependencies are a fundamental concept in database design, establishing relationships between attributes in a database. They ensure that the database is in a state of normalization, minimizing data redundancy and improving data integrity. Below are some common examples to illustrate how functional dependencies work:

Example 1: employee database

Consider a table in a database that stores employee information:

EmployeeIDEmployeeNameEmployeeAddressDepartmentID
1John Doe123 Main StD01
2Jane Smith456 Elm StD02
3Alice Johnson789 Oak StD01

EmployeeID → EmployeeName, EmployeeAddress, DepartmentID: The EmployeeID uniquely determines the EmployeeName, EmployeeAddress, and DepartmentID. Given the EmployeeID, you can find this corresponding information.

Example 2: product database

Consider a product database that stores information about products and their categories:

ProductIDProductNameCategoryIDCategoryName
101Laptop001Electronics
102Shirt002Clothing
103Coffee Maker001Electronics

ProductID → ProductName, CategoryID: The ProductID uniquely determines the ProductName and CategoryID.

CategoryID → CategoryName: The CategoryID uniquely determines the CategoryName. For instance, a CategoryID of 001 will always correspond to “Electronics”.

Example 3: university database

Consider a university database that stores information about students and their enrolled courses:

StudentIDStudentNameCourseIDCourseName
201Emma BrownC101Database
202Oliver GreenC102Networks
201Emma BrownC102Networks

StudentID, CourseID → StudentName, CourseName: The combination of StudentID and CourseID uniquely determines the StudentName and CourseName. For example, StudentID 201 and CourseID C101 will determine Emma Brown and Database respectively.

Example 4: bookstore database

Consider a bookstore database that stores information about books and their authors:

ISBNBookTitleAuthorIDAuthorName
978-1-56619-909-4Data Science Handbook301John Doe
978-1-56619-909-5Advanced Python302Jane Smith
978-1-56619-909-6Database Systems301John Doe

ISBN → BookTitle, AuthorID: The ISBN uniquely determines the BookTitle and AuthorID.

AuthorID → AuthorName: The AuthorID uniquely determines the AuthorName.

These examples illustrate how functional dependencies can help to ensure that data is accurately represented and that redundant or inconsistent information is minimized in a relational database. Understanding and properly implementing functional dependencies is a crucial step in effective database design.

Functional dependencies are a crucial aspect of database design and are used to ensure that the database is in a state of normalization. They help to minimize data redundancy and improve data integrity. However, it’s important to note that functional dependencies are not the only factor to consider when designing a database. Other factors such as performance and scalability should also be taken into account.

One of the most common ways to represent functional dependencies is using the Armstrong’s Axioms. These are a set of rules that can be used to infer functional dependencies from a given set of functional dependencies. These rules include reflexivity, augmentation, and transitivity.

Reflexivity states that if X is a subset of Y, then Y → X.

Augmentation states that if X → Y, then XZ → YZ for any attributes Z.

Transitivity states that if X → Y and Y → Z, then X → Z.

Normal forms in functional dependencies

Another way to represent functional dependencies is using the Normal Forms. Normal Forms are a set of rules that are used to determine the degree of normalization of a database. There are several Normal Forms, including First Normal Form (1NF), Second Normal Form (2NF), Third Normal Form (3NF), and so on.

First Normal Form (1NF) requires that each table have a primary key, and that all data in the table is atomic (indivisible).

Second Normal Form (2NF) requires that the table is in 1NF, and that all non-primary key attributes are functionally dependent on the primary key.

Third Normal Form (3NF) requires that the table is in 2NF, and that all non-primary key attributes are not functionally dependent on any non-primary key attributes.

It’s important to note that functional dependencies are not always easy to identify, and may require a thorough understanding of the data and the relationships between the data. Additionally, it’s not always possible to achieve higher Normal Forms, and trade-offs may need to be made between normalization and performance.

Use functional dependencies with monday work management

Functional dependencies are a crucial aspect of database design and are used to ensure that the database is in a state of normalization. They help to minimize data redundancy and improve data integrity. However, it’s important to note that functional dependencies are not the only factor to consider when designing a database. Other factors such as performance and scalability should also be taken into account. Start your trial with monday work management to power up automations, dashboards, and advanced database features.

Get started