{
  "id": "database-normalization",
  "title": "Database Normalization",
  "lang": "en",
  "source_lang": "en",
  "summary": "Database normalization organizes relational schemas using dependencies and normal forms to reduce redundancy and prevent inconsistent updates.",
  "category": "computer-science",
  "subcategory": "software",
  "type": "concept",
  "aliases": [
    "Relational database normalization",
    "database normalisation",
    "relational normalization"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/database-normalization/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/database-normalization/",
      "json": "https://aiwiki.page/zh/database-normalization.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Database normalization is the systematic organization of a relational database into relations whose structures reflect the dependencies among the facts being stored. It uses formal rules, called normal forms, to identify and reduce redundancy that can cause insertion, deletion, and update anomalies. Normalization commonly replaces a relation containing several kinds of facts with smaller relations that can be joined to reconstruct the original information.\n\nNormalization is principally a property of a database schema under specified constraints, not a property inferred solely from the rows currently present. A table may contain no repeated values today yet permit serious inconsistencies tomorrow. Conversely, the repeated appearance of an identifier in many rows does not necessarily constitute harmful redundancy: it may express a necessary relationship.\n\nThe theory developed from Edgar F. Codd’s relational model and subsequent research on functional, multivalued, and join dependencies. Its practical importance lies in separating logical correctness from storage and access decisions. A normalized design provides a disciplined representation of facts; indexing, caching, materialized views, and deliberate denormalization address different aspects of implementation and performance."
    },
    {
      "heading": "Relational foundations and historical development",
      "text": "Codd introduced the relational model in his 1970 paper “A Relational Model of Data for Large Shared Data Banks,” written while working at IBM. The model represented data through relations rather than application-visible pointer structures or fixed navigation paths. A relation has a set of named attributes and a set of tuples conforming to those attributes. In the mathematical model, tuples are distinct and their order has no significance. These properties made it possible to reason about data structures independently of particular files and access methods.\n\nThe initial normal-form requirement excluded relation-valued components from the relational representation then under discussion. During the early 1970s, Codd developed the ideas underlying second and third normal forms, which address dependencies among attributes. Raymond F. Boyce and Codd subsequently formulated the stronger condition now called Boyce–Codd normal form. Ronald Fagin extended the theory with fourth normal form in 1977 and fifth normal form in 1979, showing that redundancy can arise even when functional dependencies alone reveal no problem.\n\nA central distinction is between a relation schema and a relation instance. A schema specifies attributes and constraints; an instance is a particular set of tuples satisfying them. For example, Employee(EmployeeID, DepartmentID, DepartmentPhone) is a schema. Its intended meaning might require every department to have exactly one telephone number. That requirement applies to every legal instance, even if the current instance contains only one employee per department and therefore exhibits no visible repetition.\n\nNormalization operates at this logical level. It does not require that each relation correspond to a separate physical file, nor does it prescribe a particular indexing method. A database management system may store a normalized schema using clustered indexes, column-oriented structures, compression, or partitions. The logical decomposition and its physical implementation are separate design decisions.\n\nThe theory is closely related to relational algebra, especially projection and join. Projection retains selected attributes; join combines compatible tuples. A decomposition is useful only if these operations preserve the intended information. Consequently, normalization is not simply an instruction to create more tables. Its formal objectives concern the dependencies represented by those tables, whether their original information can be reconstructed, and whether important constraints remain enforceable."
    },
    {
      "heading": "Functional dependencies, keys, and modification anomalies",
      "text": "A functional dependency states that agreement on one set of attributes requires agreement on another. For a relation schema \\(R\\), the dependency \\(X \\to Y\\) holds when any two legal tuples with identical values on \\(X\\) also have identical values on \\(Y\\). The attributes in \\(X\\) are called a determinant. The dependency expresses a rule of the application domain, not merely a pattern observed in one dataset.\n\nA superkey is an attribute set that functionally determines every attribute of the relation. A candidate key is a minimal superkey: removing any of its attributes destroys that property. One candidate key may be designated the primary key, but normalization must consider all candidate keys. An attribute belonging to at least one candidate key is called prime. A generated identifier may be a useful primary key, but adding it does not eliminate dependencies among the remaining attributes.\n\nConsider the relation:\n\nEnrollment(StudentID, CourseID, StudentName, CourseTitle, Grade)\n\nSuppose its constraints include:\n\n\\[\\begin{aligned} \\text{StudentID} &\\to \\text{StudentName},\\\\ \\text{CourseID} &\\to \\text{CourseTitle},\\\\ \\{\\text{StudentID},\\text{CourseID}\\} &\\to \\text{Grade}. \\end{aligned}\\]\n\nThe pair (StudentID, CourseID) is a candidate key if each student has at most one recorded grade for each course. Student names repeat across enrollments, while course titles repeat across students. These repetitions are consequences of storing student facts, course facts, and enrollment facts together.\n\nThe design creates three characteristic anomalies. An update anomaly occurs when changing a course title requires changing multiple rows, with inconsistent titles possible if only some are updated. An insertion anomaly occurs when a course cannot be recorded until at least one student enrolls, unless missing or artificial enrollment values are introduced. A deletion anomaly occurs when deleting the final enrollment in a course also removes its title from the database. These are consequences of the representation, not failures of the update command itself.\n\nDependencies must be established from domain rules. A small sample in which every employee has a different job title does not establish JobTitle → EmployeeID. Similarly, a dependency valid for current assignments may fail in a historical database unless a time attribute is included. Dependency discovery can identify plausible rules, but logical schema design requires distinguishing accidental uniqueness from constraints intended to hold in every permitted state."
    },
    {
      "heading": "First normal form and the meaning of atomic values",
      "text": "First normal form—usually abbreviated 1NF—requires the conventional relational representation in which each attribute position contains one value from its domain rather than a repeating group of independently addressable values. It excludes designs such as Phone1, Phone2, and Phone3 when those columns represent an arbitrary number of occurrences of the same relationship. It also excludes treating a list of telephone numbers as though it were a single telephone-number value.\n\nA table such as Customer(CustomerID, Name, PhoneNumbers) needs careful interpretation. If PhoneNumbers contains the string \"020-1111, 020-2222\" and applications repeatedly split that string to query individual numbers, a one-to-many relationship has effectively been hidden inside a field. A relational design would ordinarily use Customer(CustomerID, Name) and CustomerPhone(CustomerID, PhoneNumber). Each telephone number can then be constrained, searched, and updated as an individual fact, and the design imposes no arbitrary upper limit through numbered columns.\n\nAtomicity is nevertheless relative to the chosen domains and operations. A date has year, month, and day components, but that does not automatically make a date-valued attribute incompatible with 1NF. Text, geographic coordinates, and identifiers can also have internal structure. The relevant issue is not whether a value can be divided in some imaginable way, but whether the schema is concealing a collection of separately meaningful occurrences that should participate in relational constraints and operations.\n\nModern SQL systems complicate terminology because many support arrays, composite types, and JSON documents. Such values can be legitimate facilities of an extended data model, but their presence does not establish that the surrounding design satisfies the assumptions of classical normalization theory. An array of independently managed order lines differs materially from a scalar measurement stored in a specialized type. Normal-form claims should therefore identify the model and interpretation under which they are made.\n\nFirst normal form also should not be equated with every practical rule for SQL table design. Classical relations contain no duplicate tuples, whereas SQL query results and unconstrained tables can contain duplicates. SQL also permits null markers, which introduce semantics absent from the simplest relational treatment. Declaring a primary key, choosing appropriate domains, and specifying nullability help bring an implementation closer to its intended logical model, but 1NF alone does not eliminate dependency-based anomalies. The enrollment relation described earlier can satisfy 1NF while still repeating student and course facts."
    },
    {
      "heading": "Second and third normal forms",
      "text": "Second normal form addresses partial functional dependencies on candidate keys. A relation is in 2NF if it is in 1NF and every nonprime attribute is fully functionally dependent on every candidate key. Equivalently, no nonprime attribute may depend on a proper subset of a candidate key. Relations whose candidate keys all consist of single attributes automatically satisfy this particular requirement, although they may violate stronger normal forms.\n\nIn the enrollment example, StudentName depends on StudentID, and CourseTitle depends on CourseID. Each determinant is only part of the composite candidate key (StudentID, CourseID). A suitable decomposition is:\n\nStudent(StudentID, StudentName)\nCourse(CourseID, CourseTitle)\nEnrollment(StudentID, CourseID, Grade)\n\nThe grade remains with the enrollment because it depends on the student–course combination. Under the stated dependencies, each resulting relation represents a distinct kind of fact. Additional business rules could require further analysis; the table names themselves do not prove that the decomposition is normalized.\n\nThird normal form—3NF—addresses a broader class of dependencies. Its formal condition is that, for every nontrivial functional dependency \\(X \\to A\\) implied by the constraints, either \\(X\\) is a superkey or \\(A\\) is prime. “Nontrivial” means that \\(A\\) is not already contained in \\(X\\). This formulation matters because it handles overlapping candidate keys more accurately than the informal instruction to remove “dependencies on nonkey columns.”\n\nFor example, consider Employee(EmployeeID, DepartmentID, DepartmentPhone) with dependencies EmployeeID → DepartmentID and DepartmentID → DepartmentPhone. If EmployeeID is the only candidate key, the relation satisfies 2NF: its key has no proper nonempty subset. It nevertheless violates 3NF because DepartmentID is not a superkey and DepartmentPhone is nonprime. Decomposing it into Employee(EmployeeID, DepartmentID) and Department(DepartmentID, DepartmentPhone) removes the repeated department telephone number.\n\nThe familiar description of 3NF as eliminating transitive dependencies is useful but incomplete without qualifications about keys and prime attributes. Functional dependencies are inherently transitive: from \\(X \\to Y\\) and \\(Y \\to Z\\), \\(X \\to Z\\) follows. What matters is whether a dependency creates the prohibited structure. Third normal form deliberately allows certain dependencies with prime right-hand attributes, even when their determinants are not superkeys. This exception makes it possible to construct decompositions that preserve all functional dependencies while remaining lossless, a guarantee that the stricter Boyce–Codd condition cannot always provide."
    },
    {
      "heading": "Boyce–Codd normal form and its trade-offs",
      "text": "Boyce–Codd normal form, or BCNF, requires every determinant of a nontrivial functional dependency to be a superkey. Formally, for every dependency \\(X \\to Y\\) implied by the schema’s constraints, either \\(Y \\subseteq X\\) or \\(X\\) is a superkey. Unlike 3NF, BCNF has no exception for prime attributes. Every BCNF relation is therefore in 3NF, but some 3NF relations are not in BCNF.\n\nA standard kind of example involves overlapping candidate keys. Let Tutorial(Student, Subject, Tutor) obey two rules: each student has one tutor for each subject, and each tutor teaches only one subject. These give:\n\n\\[\\begin{aligned} \\{\\text{Student},\\text{Subject}\\} &\\to \\text{Tutor},\\\\ \\text{Tutor} &\\to \\text{Subject}. \\end{aligned}\\]\n\nThe candidate keys are (Student, Subject) and (Student, Tutor). All three attributes are prime. The dependency Tutor → Subject is consequently permitted by 3NF, even though Tutor is not a superkey. It violates BCNF because one tutor may teach many students.\n\nA BCNF decomposition is TutorSubject(Tutor, Subject) and StudentTutor(Student, Tutor). The tutor’s subject is now recorded once rather than repeated for each student. The decomposition is lossless under the stated dependency because the common attribute, Tutor, determines the whole TutorSubject relation. Joining the two relations reconstructs the original student–subject–tutor triples.\n\nHowever, the first original dependency is not preserved by independent constraints on the two component relations. StudentTutor can contain (Mira, TutorA) and (Mira, TutorB), while TutorSubject assigns both tutors to mathematics. Each component separately satisfies its projected functional dependencies, but their join gives Mira two tutors for the same subject. Enforcing the original student–subject rule requires examining information across the decomposition.\n\nThis example illustrates why normalization is not governed by a single instruction to choose the numerically or nominally strongest form. A BCNF design removes a redundancy that 3NF can permit, but it may make an important constraint more difficult to enforce. A 3NF design can instead retain that constraint in one relation, accepting a limited redundancy. The appropriate logical choice depends on which dependencies exist and how they can be maintained; performance considerations are an additional, separate issue."
    },
    {
      "heading": "Lossless decomposition, dependency preservation, and algorithms",
      "text": "Two properties govern the correctness and usefulness of a decomposition. A lossless-join decomposition guarantees that projecting any legal original relation onto the component schemas and joining those projections yields exactly the original relation. A lossy decomposition may create spurious tuples: combinations that were never present and are not justified by the original facts. “Lossless” here concerns relational reconstruction, not lossless data compression.\n\nFor a binary decomposition of \\(R\\) into \\(R_1\\) and \\(R_2\\), with \\(R_1 \\cup R_2 = R\\), the functional-dependency criterion is:\n\n\\[(R_1 \\cap R_2) \\to R_1 \\quad\\text{or}\\quad (R_1 \\cap R_2) \\to R_2\\]\n\nin the closure of the dependency set. Thus, the common attributes must determine all attributes of at least one component. Merely sharing a column name is insufficient. Splitting Assignment(Employee, Project, Role) into (Employee, Project) and (Employee, Role) can incorrectly pair every employee’s project with every role unless the constraints justify those combinations.\n\nDependency preservation means that the original dependencies can be enforced through constraints on individual component relations, without joining them. It is distinct from losslessness: a decomposition can be lossless yet fail to preserve dependencies, as in the tutor example. To test preservation, dependencies implied over each component schema are collected, and their combined implications are compared with the original requirements. Looking only at dependencies explicitly written in the initial specification is not always sufficient.\n\nSeveral procedures rely on attribute closure. Given dependencies \\(F\\), the closure \\(X^+\\) is the set of all attributes functionally determined by \\(X\\). It can be computed by starting with \\(X\\) and repeatedly adding the right-hand attributes of dependencies whose left-hand attributes are already included. The process stops when no more attributes can be added. A set \\(X\\) is a superkey exactly when its closure contains every attribute of the relation. Closure calculations support key tests, implication tests, and normalization algorithms.\n\nA standard 3NF synthesis procedure first computes a suitable minimal cover of the dependencies, creates relations corresponding to its determinants and dependents, and ensures that a relation containing a candidate key is present. Redundant contained schemas can then be removed. The resulting decomposition can be both lossless and dependency-preserving. A standard BCNF procedure instead repeatedly splits a relation on a violating dependency \\(X \\to Y\\), producing schemas \\(X \\cup Y\\) and \\(R-(Y-X)\\). This ensures losslessness at each split but not dependency preservation. More general dependency settings use techniques such as the chase, which reasons about whether constraints force the identifications or tuple generation required by a proposed decomposition."
    },
    {
      "heading": "Multivalued dependencies and fourth normal form",
      "text": "Functional dependencies do not describe every source of redundancy. Suppose EmployeeQualification(Employee, Language, Certification) records the languages an employee speaks and the certifications that employee holds. If languages and certifications are independent facts, the table must contain every combination for each employee. An employee with three languages and four certifications requires twelve rows, despite there being only seven separately recorded language and certification facts.\n\nThis situation is described by a multivalued dependency. Informally, \\(X \\twoheadrightarrow Y\\) means that, for each fixed value of \\(X\\), the possible \\(Y\\) values are independent of the values of the remaining attributes \\(Z=R-(X\\cup Y)\\). In tuple terms, whenever two tuples agree on \\(X\\), the relation must contain the tuples obtained by exchanging their \\(Y\\) and \\(Z\\) components. The requirement concerns the presence of combinations, not simply the existence of multiple values.\n\nFor the qualification relation, the intended rules are:\n\n\\[\\text{Employee} \\twoheadrightarrow \\text{Language}, \\qquad \\text{Employee} \\twoheadrightarrow \\text{Certification}.\\]\n\nNeither language nor certification need be functionally determined by employee. If no other nontrivial functional dependencies exist, the three-attribute relation can satisfy BCNF while still containing the cross-product redundancy. Fourth normal form, or 4NF, addresses this case: every nontrivial multivalued dependency must have a superkey as its determinant. A multivalued dependency is trivial if its right-hand attributes are contained in its left-hand attributes or if the two sides together cover the schema.\n\nThe appropriate decomposition is EmployeeLanguage(Employee, Language) and EmployeeCertification(Employee, Certification). Joining these relations reconstructs every valid combination precisely because independence is part of the meaning. Inserting a certification now adds one fact rather than one row for every language. Functional dependencies are special cases of multivalued dependencies, so 4NF also implies BCNF.\n\nThe independence assumption is essential. If a certification qualifies an employee to work only in a particular language, the language–certification pairing is itself meaningful. Decomposing into separate language and certification relations would then manufacture unsupported combinations. Similarly, storing suppliers’ parts and delivery regions separately is valid only if every listed supplier–part pairing applies to every listed region for that supplier. Repetition alone cannot establish a multivalued dependency; the permitted combinations must follow from the domain’s rules."
    },
    {
      "heading": "Join dependencies, fifth normal form, and specialized forms",
      "text": "A join dependency generalizes lossless decomposition to any number of projections. For a schema \\(R\\) and component schemas \\(R_1,\\ldots,R_n\\), a join dependency requires each legal instance \\(r\\) to satisfy:\n\n\\[r=\\mathop{\\bowtie}_{i=1}^{n}\\pi_{R_i}(r).\\]\n\nThe equation says that joining those projections introduces no additional tuples. Multivalued dependencies correspond to a particular two-component case, but some redundancies require decompositions into three or more components and cannot be removed through the corresponding nontrivial binary decompositions.\n\nFifth normal form, also called project-join normal form, requires every nontrivial join dependency to be implied by candidate keys. Consider Supply(Supplier, Part, Project). Its triples might be governed by a rule stating that a supplier supplies a part to a project exactly when the supplier is approved for that part, the supplier is approved for that project, and the project uses that part. Under this rule, the full relation is reconstructed from SupplierPart, SupplierProject, and ProjectPart.\n\nFor example, the projections of the triples (S1, P1, J2), (S1, P2, J1), and (S2, P1, J1) collectively contain all three pairs needed to generate (S1, P1, J1). A schema governed by the stated join dependency must therefore include that fourth triple. If the fourth combination is not valid in the application, the dependency does not hold and the three-way decomposition is inappropriate. Pairwise compatibility does not ordinarily guarantee the validity of a complete business relationship.\n\nHigher and alternative normal forms address other theoretical requirements. Domain-key normal form, introduced by Fagin in 1981, characterizes schemas whose constraints follow entirely from domain constraints and key constraints. Its attraction is that no additional kinds of constraints would be needed to characterize legal states. Many practical business rules, however, do not reduce naturally to domains and keys, making it a theoretical target rather than a universally achievable design prescription.\n\nSixth normal form concerns the absence of nontrivial join dependencies: its relations are irreducible under such decompositions. It is particularly associated with approaches to temporal data in which independently changing facts are represented separately. This use should not be confused with the claim that every ordinary application should fragment its tables to the smallest possible size. Normal forms beyond the familiar functional-dependency hierarchy depend on the dependency language, temporal model, and design objectives being considered."
    },
    {
      "heading": "Implementing normalized schemas in SQL systems",
      "text": "A normalized logical design must be translated into enforceable database constraints. Primary keys and unique constraints identify tuples and express candidate-key restrictions. A foreign key expresses referential integrity between related relations. For example, Enrollment.StudentID may reference Student.StudentID, ensuring that an enrollment cannot name an absent student. A foreign key is not itself a normal-form condition; it supports the integrity of the schema produced by decomposition.\n\nNullability requires explicit attention. A candidate key in the classical relational sense uniquely identifies every tuple, whereas SQL unique constraints may permit null markers according to the system’s rules. A nullable UNIQUE column therefore need not implement the intended candidate-key semantics. Likewise, declaring DepartmentID as a foreign key in Employee does not establish that every employee has a department unless an appropriate non-null requirement or other rule is also enforced.\n\nNormalization can turn some cross-row rules into straightforward local constraints. In an unnormalized employee table, maintaining one telephone number per department may require checking many employee rows. In a separate Department table, a primary key on DepartmentID makes one stored telephone value per department natural. Nevertheless, some constraints remain inherently cross-table or cross-row, such as capacity limits, scheduling conflicts, and rules lost through a non-dependency-preserving decomposition.\n\nSuch constraints may require triggers, specialized constraint mechanisms, or application operations enclosed in a database transaction. Concurrency matters: two transactions can each pass a preliminary check and then jointly violate a rule. Appropriate locking, isolation, or constraint enforcement must make the check and modification behave correctly together. Normalization does not replace the ACID properties of transactions, and transaction isolation does not repair an incorrectly modeled dependency.\n\nSchema migration also requires more than copying columns into new tables. Existing data may violate intended dependencies—for example, the same department identifier may already have two telephone numbers. The migration must resolve those conflicts, populate the new relations, establish keys and references, and modify readers and writers consistently. Views can preserve an earlier interface by presenting joins over the new design, although not every joined view is automatically updatable. These implementation tasks connect normalization to data quality and software engineering without changing its formal definition."
    },
    {
      "heading": "Performance, denormalization, and contemporary data architectures",
      "text": "Normalization concerns logical dependencies, not a universal performance ranking. A normalized design can reduce storage and write amplification by storing a changing fact once. It can also require additional joins to assemble an application’s output. The cost depends on relation sizes, selectivity, memory, available access paths, and the optimizer’s execution plan. A database index can make a join inexpensive, while a poorly selective query over large relations can remain costly regardless of the schema’s normal form.\n\nDenormalization deliberately introduces redundancy, usually to meet a measured access requirement. Examples include copying a customer display name into a search-oriented table or storing a precomputed order total. The duplicated value then creates a maintenance obligation: the system must determine which representation is authoritative, how updates propagate, and whether temporary disagreement is acceptable. A generated identifier, an extra index, or a different physical row layout is not by itself denormalization, because these changes need not introduce additional logical dependencies or duplicated business facts.\n\nAnalytical systems often make different trade-offs from transaction-processing systems. A data warehouse may use a star schema with fact tables and descriptive dimension tables. Dimensions can intentionally combine attributes that a more normalized design would separate, reducing the number of joins needed for common analyses. Historical dimension versions introduce another distinction: a customer’s address at the time of a sale is not necessarily a redundant copy of the customer’s current address. The two values can represent different facts and therefore require different dependency rules.\n\nIn distributed computing, joins across machines may involve substantial network communication, encouraging co-location or duplication of frequently accessed data. Many NoSQL designs embed related information to support a particular access pattern, although nonrelational models can also apply analogous reasoning about ownership, dependencies, and update anomalies. Duplication across service boundaries may be a deliberate architectural choice, but it still requires defined consistency and synchronization behavior. Neither distribution nor document storage makes conflicting representations of the same fact harmless.\n\nA practical evaluation therefore separates several questions: whether the dependencies correctly express the domain, whether decomposition preserves information, where constraints can be enforced, and how the workload executes on the chosen system. Benchmarks can assess latency, throughput, storage, and update cost; they cannot establish whether a functional dependency is semantically valid. Conversely, a proof that a schema satisfies BCNF does not predict its query latency. Logical normalization and physical optimization answer different questions and remain independently necessary in database design."
    }
  ],
  "links": [
    "relational-database",
    "database-schema",
    "ibm",
    "database-management-system",
    "primary-key",
    "sql",
    "lossless-data-compression",
    "foreign-key",
    "database-transaction",
    "acid-properties",
    "data-quality",
    "software-engineering",
    "database-index",
    "denormalization",
    "data-warehouse",
    "distributed-computing",
    "nosql"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}