liveBook · Manning

Insertion anomaly

As explained in Grokking Relational Database Design

An insertion anomaly is an undesirable data-maintenance problem in which a record cannot be added without also supplying unrelated or duplicated information.

An insertion anomaly occurs when adding a new record requires unrelated data. It commonly appears in poorly designed tables that combine information belonging to different entities. section 3.3 section 1.3

A product without a customer

Imagine one table storing customers and products together. When adding a product that nobody has bought, the table still requires valid customer information. The conflicting requirements prevent the product from being added, creating an insertion anomaly. section 1.3

Reduce insertion anomalies by improving the table design:

  • Minimize data redundancy and define appropriate data types, constraints, and relationships among entities. section 3.3
  • Break tables apart when dependencies create design problems, then connect the resulting tables with a foreign key when appropriate. section 6.7

How Grokking Relational Database Design covers it

How deep it goes
Defines the anomaly and works through a customer-product example, then points toward constraints, relationships, and table decomposition.
Examples
Uses a combined customer-product table and the attempted addition of a product without a customer.
What you can do after
Diagnose insertion anomalies and evaluate table designs for redundancy, constraints, relationships, and unnecessary data requirements.
How it connects
Connects insertion anomalies to data redundancy, data consistency, update anomalies, delete anomalies, transitive dependency, and normalization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Relational Database Design. The section links point to the parts of the book it draws on.