Database Design and Normalization
Functional Dependency and Attribute Closure
A Functional Dependency () is an integrity constraint between two sets of attributes in a relational database, specifying that the values of the determinant on the left-hand side uniquely and accurately determine the values of the dependent on the right-hand side. Formally, for any two tuples and in a relation, if , then . Functional dependencies are categorized as trivial when the dependent is a subset of the determinant (), non-trivial when the dependent is not a subset of the determinant (), multi-valued () when independent multiple values exist for a single determinant value, or transitive when dependency occurs indirectly through an intermediate attribute ( and imply ).
Attribute closure, denoted as , is the complete set of attributes functionally determined by the attribute set . A super key is any attribute set whose closure encompasses all attributes of the relation schema. A candidate key is a minimal super key such that no proper subset can determine all relation attributes. Attributes belonging to any candidate key are defined as prime attributes, whereas attributes that are not part of any candidate key are non-prime attributes.
Armstrong's Axioms and Canonical Cover
Armstrong's axioms provide the sound and complete inference rules used to derive functional dependencies: Reflexivity (if , then ), Augmentation (if , then ), and Transitivity (if and , then ). Additional secondary rules derived from these axioms include Union (if and , then ), Decomposition (if , then and ), Pseudotransitivity (if and , then ), and Composition (if and , then ).
A canonical cover, also known as an irreducible set, is the minimal and simplified equivalent representation of a set of functional dependencies. Computing a canonical cover entails transforming all dependencies to have a single attribute on the right-hand side, removing redundant or non-essential functional dependencies via closure testing, and eliminating extraneous attributes from the left-hand side of the remaining dependencies. Two dependency sets are equivalent () if and only if each functional dependency in can be derived from () and vice versa ().
Normal Forms and Advanced Dependencies
Database normalization organizes relations into progressively stricter normal forms to eliminate data redundancy, update anomalies, and inconsistencies. First Normal Form (1NF) requires that every attribute domain contains only atomic, single values. Second Normal Form (2NF) requires a relation to be in 1NF with no partial dependencies, meaning no non-prime attribute depends on a proper subset of any candidate key. Third Normal Form (3NF) requires a relation to be in 2NF with no transitive dependencies for non-prime attributes; for every non-trivial dependency , either must be a super key or must be a prime attribute. Boyce-Codd Normal Form (BCNF) strictly requires that for every non-trivial dependency , the determinant must be a super key.
Fourth Normal Form (4NF) requires a relation to be in BCNF (or 3NF) and devoid of any non-trivial multi-valued dependencies (). Formally, an MVD exists in relation if for any pair of tuples and with , tuples and must exist such that , , , and remaining attributes are interchanged. Fifth Normal Form (5NF) requires a relation to be in 4NF and free of join dependencies (JD), meaning it cannot undergo further lossless non-additive decomposition. An inclusion dependency is an inter-relational constraint stating that values appearing in specific columns of a referring relation must be contained within the primary key columns of the referenced relation.
Relational Decomposition
Decomposition divides a single relation into multiple sub-relations to eliminate design flaws when schemas violate normal forms. A decomposition is lossless (non-additive) if joining the sub-relations reconstitutes the exact original relation without extraneous tuples (). For a binary decomposition of into and , the join is lossless if and only if , , and forms a super key for at least one sub-relation ( or ).
A decomposition is lossy when the natural join of decomposed sub-relations generates extraneous tuples (), failing to reconstruct the original dataset accurately. Alongside lossless join properties, decomposition must ideally satisfy dependency preservation, ensuring that every functional dependency present in the initial relation schema is directly represented or inferable within the sub-relations without requiring cross-table joins.