Functional Dependency in a Database

Functional dependencies help avoid data duplication

Woman holding report in office, close-up

 Ken Reid/Getty Images

A functional dependency in a database enforces a set of constraints between attributes. This occurs when one attribute in a relation uniquely determines another attribute. This can be written A -> B which means "B is functionally dependent upon A." This is also called a database dependency

In this relationship, A determines the value of B, while B depends on A.

Why Functional Dependency Is Important in Database Design

Functional dependency helps ensure the validity of data. Consider a table Employees that lists characteristics including Social Security Number (SSN), name, date of birth, address and so on.

The attribute SSN will determine the value of name, date of birth, address and perhaps other values, because a social security number is unique, while a name, date of birth or address may not be. We can write it like this:

SSN -> name, date of birth, address

Therefore, name, date of birth and address are functionally dependent on SSN. However, the reverse statement (name -> SSN) is not true because more than one employee can have the same name but will never have the same SSN. Put another, more concrete way, if we know the value of the SSN attribute, we can find the value of name, date of birth and address. But if we instead know the value of only the name attribute, we cannot identify the SSN.

The left side of a functional dependency can include more than one attribute. Let's say we have a business with multiple locations. We might have a table Employee with attributes employee, title, department, location and manager.

The employee determines the location he's working, so there's a dependency:

employee -> location

But the location might have more than one manager, so employee and department together determine the manager:

employee, department -> manager

Functional Dependency and Normalization

Functional dependency contributes to what is called database normalization, which ensures data integrity and reduces data redundancies. Without normalization, there is no assurance that the data in a database is accurate and dependable. 

Was this page helpful?