Normal Forms   «Prev  Next»

Lesson 8 What does it mean when columns are functionally dependent?
Objective Define functional dependencies.

Define Functional Dependencies

Question: Explain the role of functional dependencies during the normalization process?
Functional dependencies play a crucial role in the database normalization process, particularly in defining the relationships between attributes (or columns) within a database table. The concept of functional dependency is integral to understanding how data is logically related and how this affects the structure of the database. Here is an explanation in a tentative, technical writing style:

Definition of Functional Dependency

  • Basic Concept: A functional dependency in a database context exists when one attribute uniquely determines another attribute. For instance, if we have an attribute A (like a Social Security Number) that uniquely determines another attribute B (like an individual's name), then B is functionally dependent on A.

Role in Normalization

  1. Identifying Redundancies: Functional dependencies help in identifying redundant data within a table. If two rows have the same value for a certain attribute, and this leads to identical values in another attribute, it might indicate unnecessary duplication.
  2. Guiding Normal Form Transitions:
    • First Normal Form (1NF): While functional dependencies are not the primary focus in achieving 1NF, understanding them can help in identifying and removing repeating groups, which is a key aspect of 1NF.
    • Second Normal Form (2NF): This is where functional dependencies become more critical. A table is in 2NF if it is in 1NF and if all non-key attributes are fully functionally dependent on the primary key. This implies that any partial dependency of attributes on a subset of a composite key needs to be removed.
    • Third Normal Form (3NF): A table is in 3NF if it is in 2NF and if there are no transitive dependencies for non-prime attributes. A transitive dependency is a kind of functional dependency where a non-prime attribute is functionally dependent on another non-prime attribute.
  3. Improving Database Design: Understanding functional dependencies enables better database design, as it helps in structuring tables to minimize redundancy and enhance data integrity. This results in more efficient data retrieval and updates.
  4. Facilitating Data Integrity: By properly aligning data according to functional dependencies, it's possible to ensure higher data integrity and consistency, as changes in data in one part of the database correctly reflect in all relevant parts.

Limitations and Considerations

  • Complexity in Large Databases: Identifying and managing functional dependencies in large databases with numerous attributes can be complex.
  • Dynamic Nature: Functional dependencies may evolve over time as the requirements and structure of the database change, necessitating ongoing analysis.

In conclusion, functional dependencies are integral to the normalization process, guiding the restructuring of tables from lower to higher normal forms. This systematic approach ensures that the database is efficient, maintains data integrity, and minimizes redundancy, although it requires careful analysis and may introduce complexity in database design and maintenance.

Functional Dependencies and Second Normal Form

In order for a relation to be in (2NF) second normal form, the technical definition states that every non-key attribute must be functionally dependent on every column in the primary key. Let us begin by defining functional dependencies.
Consider the following relation:
Customer (CustID, CustFirst, CustLast, Address, Phone)

In this relation, CustID is the primary key, which means that every record in the table will contain a unique CustID value. It also means that a Customer relation's CustID field determines the values of the other fields in the relation. In other words, the CustFirst, CustLast, Address, and Phone attributes are functionally dependent on the contents of the CustID field. The field(s) that determine the values of other fields in a relation is known as the relation's determinant[1] . A determinant is always a candidate key[2] for the relation.

Functional Dependency Direction

Since more than one customer can have the same name, live at the same address, and have the same phone number, the functional dependency does not work in the opposite direction. In other words, the CustID field is not functionally dependent on the CustFirst, CustLast, Address, and Phone fields.
An attribute A is functionally dependent on a "set of attributes X" if and only if
a "Value of X" uniquely determines a value of A.
A functional dependency says:
If you give me the value of the primary key, that will give me the rest of the fields in the relationship.
All the fields in the row are dependent on the primary key[3]. Using a biological example, the mother is functionally dependent on the child.
Functional dependency is a 1 to 1 relationship. For every child, there is only one mother. That is why the relationship goes from child to mother. It is denoting a 1 to 1 relationship where the fields ("set of attributes X") are dependent on the primary key. The primary key is the determinant.

X --> A
child --> mother
mother --> child

  1. The value of child implies the value of mother
  2. Value of mother does NOT imply value of child
  3. Child is the determinant (For every child, there is only one mother)

Dependency and Determinants

  1. Functional dependency: Z is functionally dependent on X if the value of Y is determined by X. In other words, if Y = X +1, the value of X will determine the resultant value of Y. Thus, Y is dependent on X as a function of the value of X.
  2. Transitive dependence: Z is transitively dependent on X when X determines Y and Y determines Z. Transitive dependence thus describes that Z is indirectly dependent on X through its relationship with Y.

The functional dependency constraint establishes a functional relationship among two sets of attributes X and Y. This constraint specifies that the value of X determines a unique value of Y in all states of a relation; it is denoted as a functional dependency
X --> Y.

The next lesson describes the process of identifying functional dependencies.

[1]Determinant: The determinant in the description of functional dependency in the previous point is X because X determines the value Y, at least partially because 1 is added to X as well. A determinant is the inversion or opposite of functional dependency.
[2]Candidate key: A candidate key (potential or permissible key) is a field or combination of fields that can act as a primary key field for a table. Thus uniquely identifying each record in the table.
[3]primary key:A field (or combination of fields) that uniquely identifies a record in a table.