4.2 Relational Database Architecture & Normalization
Key Takeaways
- The relational database model organizes data into two-dimensional tables (relations) defined by attributes (columns) and tuples (rows), governed by formal mathematical schema constraints.
- Entity integrity requires that every primary key is strictly unique and NOT NULL, while referential integrity requires every foreign key value to match an existing primary key in the referenced parent table or be explicitly NULL.
- Database normalization is a systematic design discipline that eliminates redundant data storage and prevents Insert, Update, and Delete anomalies in transactional systems.
- The standard normalization progression advances through First Normal Form (1NF: atomic values, no repeating groups), Second Normal Form (2NF: in 1NF with no partial dependencies), to Third Normal Form (3NF: in 2NF with no transitive dependencies).
- Relational enterprise systems enforce ACID properties (Atomicity, Consistency, Isolation, Durability) to guarantee ledger transaction integrity, contrasting with distributed NoSQL systems operating under BASE (Basically Available, Soft state, Eventual consistency).
Relational Database Architecture & Normalization
Quick Summary: Relational Database Management Systems (RDBMS) form the structural backbone of enterprise financial accounting, ERP platforms, and general ledgers. CPAs must understand relational database theory—including primary and foreign keys, entity and referential integrity constraints, and database normalization (1NF through 3NF)—to assess whether an organization's systems prevent data anomalies, prevent transaction loss, and maintain strict ACID transactional guarantees.
1. Foundations of Relational Architecture: Tables, Keys & Constraints
Formulated by E.F. Codd in 1970, the relational database model organizes structured data into mathematical relations, universally visualized as two-dimensional tables.
Formal Relational Terminology vs. Common Terms
| Formal Relational Term | Common Database Term | Spreadsheet Equivalent | Architectural Definition |
|---|---|---|---|
| Relation | Table | Worksheet / Tab | A two-dimensional structure containing unordered tuples sharing identical attributes. |
| Attribute | Column / Field | Column | A named characteristic or data element with a defined data domain (type and constraints). |
| Tuple | Row / Record | Row | A single instance of an entity containing an ordered set of attribute values. |
| Domain | Data Type & Range | Column Validation Rule | The set of all permissible, valid atomic values for a specific attribute. |
| Cardinality | Row Count | Number of Rows | The total count of tuples currently stored within a relation. |
| Degree | Column Count | Number of Columns | The total count of attributes comprising the relation schema. |
The Hierarchy of Database Keys
Keys are attributes or groups of attributes that enforce uniqueness and establish relational links between tables:
┌─────────────────────────────────────────────────────────────┐
│ SUPERKEYS │
│ Any set of attributes that uniquely identifies a tuple │
│ Example: {SSN}, {SSN, Name}, {SSN, Email, Zip} │
│ │
│ ┌───────────────────────────────────────────────────┐ │
│ │ CANDIDATE KEYS │ │
│ │ Minimal Superkeys with no redundant attributes │ │
│ │ Example: Candidate 1 = {SSN}, Candidate 2 = {Email}│ │
│ │ │ │
│ │ ┌─────────────────────────────────────────┐ │ │
│ │ │ PRIMARY KEY │ │ │
│ │ │ The chosen unique identifier │ │ │
│ │ │ (Strictly Unique and NOT NULL) │ │ │
│ │ └─────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
- Superkey: Any combination of attributes that uniquely identifies a row in a relation.
- Candidate Key: A minimal superkey—a set of attributes that guarantees uniqueness with zero redundant columns. A table may have multiple candidate keys.
- Primary Key (PK): The specific candidate key chosen by database architects to uniquely identify each tuple in the table. Must be strictly unique and cannot contain NULL values.
- Foreign Key (FK): An attribute in a child table that references the primary key of a parent table, establishing a formal relational link.
- Composite Key: A primary key composed of two or more attributes combined (e.g.,
Order_ID+Line_Item_ID). - Surrogate Key vs. Natural Key:
- Natural Key: A data value with inherent business meaning (e.g., Social Security Number, Taxpayer ID, Vehicle Identification Number).
- Surrogate Key: A system-generated, artificial unique identifier with zero intrinsic business meaning (e.g., an auto-incrementing integer
ID: 10048or a 128-bit UUID). Surrogate keys protect database relationships when natural business keys change.
Core Relational Integrity Constraints
RDBMS engines enforce four universal integrity constraints that auditors evaluate as key automated IT application controls:
- Entity Integrity: Mandates that no primary key attribute can evaluate to
NULL. Because the primary key serves to uniquely identify a specific tuple, aNULLprimary key would imply an entity cannot be identified, violating fundamental relational logic. - Referential Integrity: Mandates that every foreign key value in a child table must either (a) match an existing primary key value in the referenced parent table, or (b) be explicitly
NULL(if business rules permit optional relationships). - Domain Integrity: Mandates that all attribute values conform strictly to defined data types, lengths, character formats, and allowable range checks (e.g.,
CHECK (Account_Type IN ('Asset', 'Liability', 'Equity', 'Revenue', 'Expense'))). - User-Defined / Business Integrity: Custom business logic rules enforced via database triggers, stored procedures, or transaction constraints (e.g., verifying that the sum of debits strictly equals the sum of credits before committing a general ledger journal batch).
Referential Integrity Violations & Audit Risks
When developers disable database foreign key constraints (often done improperly to increase bulk data ingestion speed), severe accounting anomalies occur:
- Orphaned Transactions: If a customer record is deleted from the
Customersparent table while their sales orders remain in theOrderschild table, those orders become "orphaned." Financial reporting queries joining these tables will omit these sales, leading to an understatement of accounts receivable and revenue. - Cascading Delete Risks (
ON DELETE CASCADE): If a parent table is configured with cascading deletes, deleting a master customer profile will automatically and irreversibly delete all historical invoices, payments, and credit memos associated with that customer. In financial accounting, CPAs expect databases to enforceON DELETE RESTRICTorON DELETE NO ACTION, prohibiting the deletion of any master entity that possesses historical transaction records.
2. Database Anomalies in Unnormalized Data
When a database is poorly designed—such as storing flat spreadsheet-like structures with repeating attributes in a single table—the system suffers from data redundancy, which directly generates three catastrophic operational flaws known as modification anomalies:
┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ UNNORMALIZED SALES SPREADSHEET TABLE: `tbl_Sales_Dump` │
├──────────┬────────────┬─────────────┬──────────────┬─────────────┬─────────┬──────────────┬───────────┤
│ Inv_Num │ Inv_Date │ Cust_ID │ Cust_Name │ Cust_City │ Item_ID │ Item_Desc │ UnitPrice │
├──────────┼────────────┼─────────────┼──────────────┼─────────────┼─────────┼──────────────┼───────────┤
│ 1001 │ 2026-10-01 │ C-401 │ Apex Global │ Chicago │ ITM-88 │ 4K Monitor │ $350.00 │
│ 1001 │ 2026-10-01 │ C-401 │ Apex Global │ Chicago │ ITM-92 │ USB-C Dock │ $150.00 │
│ 1002 │ 2026-10-02 │ C-401 │ Apex Global │ Chicago │ ITM-88 │ 4K Monitor │ $350.00 │
│ 1003 │ 2026-10-03 │ C-505 │ Beacon Ltd │ Boston │ ITM-14 │ Ergonomic Kbd│ $85.00 │
└──────────┴────────────┴─────────────┴──────────────┴─────────────┴─────────┴──────────────┴───────────┘
The Three Modification Anomalies
- Insert Anomaly: The inability to record critical business information without artificially inserting unrelated data.
- Example: In the table above, management cannot enter a newly introduced inventory item (
ITM-99: Wireless Mouse, $45.00) into the database until a customer actually purchases it, because the table's composite primary key requires anInv_Num. Inserting a dummy invoice withNULLor fake customer data violates entity integrity.
- Example: In the table above, management cannot enter a newly introduced inventory item (
- Update (Modification) Anomaly: When an attribute value that appears redundantly across many tuples is altered, every single instance must be updated. If the update is incomplete, the database enters an inconsistent, corrupt state.
- Example: If customer
C-401 (Apex Global)relocates from Chicago to Dallas, an automated update script that only touches the most recent invoice row will leave prior invoice records showing Chicago. A subsequent sales tax audit query will generate conflicting geographic revenue numbers.
- Example: If customer
- Delete Anomaly: When the deletion of one economic fact inadvertently causes the unintended, irreversible loss of an entirely separate business fact.
- Example: If invoice
1003was entered in error and must be purged, deleting that row completely erases customerC-505 (Beacon Ltd)and their location from the enterprise database. All corporate knowledge of Beacon Ltd's existence vanishes simply because their only transaction was cancelled.
- Example: If invoice
3. Step-by-Step Normalization Walkthrough (1NF $\rightarrow$ 2NF $\rightarrow$ 3NF)
Database Normalization is a systematic mathematical design procedure that decomposes complex tables into smaller, well-structured relations, eliminating redundancy and curing all three modification anomalies.
The Golden Rule of Normalization
In the memorable phrasing attributed to Bill Kent: "Every non-key attribute must provide a fact about the key, the whole key, and nothing but the key, so help me Codd."
┌────────────────────────┐
│ Unnormalized Form │ Contains repeating groups, non-atomic values, or nested arrays.
└───────────┬────────────┘
│ Rule: Make all attributes atomic; eliminate repeating groups; assign a primary key.
▼
┌────────────────────────┐
│ First Normal Form │ All values are atomic. Primary key assigned (often composite).
│ (1NF) │ Flaw: Contains Partial Dependencies.
└───────────┬────────────┘
│ Rule: Eliminate partial dependencies (non-key attributes depending on part of composite key).
▼
┌────────────────────────┐
│ Second Normal Form │ In 1NF + Every non-key attribute depends on the ENTIRE primary key.
│ (2NF) │ Flaw: Contains Transitive Dependencies.
└───────────┬────────────┘
│ Rule: Eliminate transitive dependencies (non-key attributes depending on other non-key attributes).
▼
┌────────────────────────┐
│ Third Normal Form │ In 2NF + No non-key attribute depends transitively on the primary key.
│ (3NF) │ Result: Redundancy minimized; Insert, Update, Delete anomalies eliminated!
└────────────────────────┘
Step 1: First Normal Form (1NF)
- Formal Requirements:
- Every attribute cell must contain only atomic (indivisible) values. Multi-valued fields (e.g., storing a comma-separated list of items
"ITM-88, ITM-92"in a single cell) are strictly prohibited. - There must be no repeating groups or duplicate columns (e.g.,
Item_1,Item_2,Item_3). - Each record must be uniquely identifiable via an established Primary Key.
- Every attribute cell must contain only atomic (indivisible) values. Multi-valued fields (e.g., storing a comma-separated list of items
- Resolution: We flatten repeating rows so each line item has its own tuple and establish a composite primary key consisting of
{Invoice_Num, Item_ID}. - Why 1NF Is Insufficient: While all fields are atomic, the table contains Partial Functional Dependencies:
Cust_NameandCust_Citydepend only onInvoice_Num, not onItem_ID.Item_DescandUnitPricedepend only onItem_ID, not onInvoice_Num.- This partial dependency causes massive data redundancy across multi-line invoices.
Step 2: Second Normal Form (2NF)
- Formal Requirements:
- The relation must be in First Normal Form (1NF).
- The relation must have no partial functional dependencies—every non-key attribute must be fully functionally dependent on the entire primary key. (Note: If a table in 1NF has a single-column primary key rather than a composite key, it is automatically in 2NF!)
- Resolution: Decompose the relation into three separate tables, isolating attributes with their functional determiners:
Invoices(Invoice_Num[PK],Invoice_Date,Cust_ID,Cust_Name,Cust_City)Items(Item_ID[PK],Item_Desc,Current_List_Price)Invoice_Line_Items(Invoice_Num[PK, FK],Item_ID[PK, FK],Quantity_Billed,Billed_Price)
- Why 2NF Is Insufficient: Look at the
Invoicestable.Invoice_Numis the primary key.Cust_IDdepends onInvoice_Num. However,Cust_NameandCust_Citydepend directly onCust_ID! This is a Transitive Dependency: Because of this transitive chain, an update anomaly still exists: if Apex Global changes its address, we still have to update multiple invoice records.
Step 3: Third Normal Form (3NF)
- Formal Requirements:
- The relation must be in Second Normal Form (2NF).
- The relation must contain no transitive functional dependencies—no non-key attribute can depend on another non-key attribute. Every non-key attribute must depend directly on the primary key alone.
- Resolution: Extract the transitively dependent attributes out of
Invoicesinto a dedicatedCustomerstable:CustomersTable:Cust_ID[PK],Cust_Name,Cust_CityInvoicesTable:Invoice_Num[PK],Invoice_Date,Cust_ID[FK referencing Customers]Invoice_Line_ItemsTable:Invoice_Num[PK, FK],Item_ID[PK, FK],Quantity_Billed,Billed_Unit_PriceItemsTable:Item_ID[PK],Item_Desc,Standard_List_Price
The Accounting Rationale for Historical Billed Prices
Notice that Billed_Unit_Price is retained in Invoice_Line_Items, even though Items has Standard_List_Price.
- CPA Exam Insight: This is not redundant data.
Standard_List_Pricerepresents the current catalog price, which fluctuates over time.Billed_Unit_Pricerepresents the immutable historical price contracted at the exact moment the invoice was posted. Overwriting historical sales prices with current catalog prices would illegally alter prior-period audited revenues!
OLTP vs. OLAP (Normalization vs. Denormalization)
| Architectural Attribute | OLTP (Online Transaction Processing) | OLAP (Online Analytical Processing) |
|---|---|---|
| Primary Business Goal | High-speed, high-volume real-time transaction processing | Complex analytical querying, trend analysis, and aggregation |
| Database Design | Highly Normalized (3NF / BCNF) | Denormalized (Star Schema / Snowflake Schema) |
| Data Redundancy | Strictly minimized to zero | Intentionally introduced to eliminate expensive SQL joins |
| Performance Profile | Fast, lock-free INSERT, UPDATE, and DELETE | Ultra-fast SELECT aggregations across millions of rows |
| Audit Concern | ACID compliance, entity integrity, referential integrity | ETL data reconciliation, point-in-time snapshot consistency |
4. Transactional Integrity: ACID Properties vs. NoSQL / BASE
In financial accounting, a single economic event frequently alters multiple database tables simultaneously. When a customer pays a $10,000 receivable, the system must execute two distinct operations:
UPDATE Cash SET Balance = Balance + 10000;UPDATE Accounts_Receivable SET Balance = Balance - 10000;
If a power failure or network severance occurs between Step 1 and Step 2, the general ledger becomes unbalanced. To prevent this, enterprise relational databases enforce ACID properties.
The Four ACID Properties
- Atomicity (All or Nothing): Every database transaction is treated as an indivisible atomic unit of work. Either all SQL statements within the transaction block commit successfully to disk, or the entire transaction is completely rolled back to its pre-transaction state. Partial execution is mathematically impossible.
- Consistency (Preserving Invariants): A transaction can only transition the database from one valid state to another valid state, maintaining all schema constraints, referential integrity rules, triggers, and balance sheet invariants ($Assets = Liabilities + Equity$). If any operation violates a rule, the entire transaction aborts.
- Isolation (Concurrent Independence): Multiple transactions executing concurrently must execute without interfering with each other. The intermediate uncommitted state of an in-flight transaction must remain invisible to other concurrent transactions.
- ANSI SQL Isolation Levels (from weakest to strongest):
- Read Uncommitted: Lowest isolation; allows Dirty Reads (reading uncommitted data that might subsequently roll back).
- Read Committed: Prevents dirty reads; queries only see committed data. However, Non-Repeatable Reads can occur (re-reading a row within the same transaction yields different data because another transaction committed an update).
- Repeatable Read: Guarantees that any row read during a transaction cannot be modified by another transaction. However, Phantom Reads can occur (new rows inserted by concurrent transactions matching a
WHERErange). - Serializable: Highest isolation level; forces concurrent transactions to execute as if they were processed strictly sequentially (serially). Completely eliminates dirty reads, non-repeatable reads, and phantoms, but imposes heavy lock contention and reduced throughput.
- ANSI SQL Isolation Levels (from weakest to strongest):
- Durability (Survival Across Failures): Once a transaction commits and acknowledges success, its changes are permanently recorded in non-volatile storage. Even if the database server immediately suffers a catastrophic physical power loss, the transaction survives intact, guaranteed by Write-Ahead Logging (WAL).
BASE Architecture in Distributed NoSQL Systems
While traditional RDBMS suites (PostgreSQL, Oracle, SQL Server) enforce strict ACID guarantees, modern distributed NoSQL systems (MongoDB, Apache Cassandra, DynamoDB) often adopt the BASE model governed by Brewer's CAP Theorem:
- Basically Available: The system guarantees availability across distributed clusters, even during localized node outages.
- Soft State: Data values may drift or shift over time without direct user interaction due to background replication.
- Eventual Consistency: Given sufficient time without new updates, all distributed replicas will eventually synchronize and become consistent.
CPA Assurance Mandate: Core financial accounting ledgers, cash disbursement engines, and securities trading systems must never utilize eventual consistency BASE databases. Financial ledgers strictly mandate ACID compliance with high isolation levels to ensure that trial balances, cash balances, and financial statements remain mathematically precise and auditably defensible.
An IT auditor reviews a financial database schema containing a table tbl_Vendor_Purchases with a composite primary key consisting of Purchase_Order_Num and Line_Item_ID. The auditor notes that the non-key attribute Vendor_Payment_Terms depends solely on Purchase_Order_Num. What normalization violation is present, and what normal form does this table fail to achieve?
During a review of database integrity controls for an ERP general ledger, an auditor discovers that the foreign key constraint connecting the gl_journal_lines table to the chart_of_accounts master table was configured with ON DELETE CASCADE. What is the primary audit risk associated with this configuration?
In the context of database transaction processing for financial accounting systems, which of the following best characterizes the 'Atomicity' property under the ACID framework?