How to Check Second Normal Form (2NF): Find Partial Dependencies on Composite Keys
A functional dependency `X → Y` means that, under a business rule, equal X values must imply equal Y values. Y depends fully on a composite X only if removing any attribute from X makes the dependency stop holding. If the dependency remains after removing part of X, it is partial.
How to Check Second Normal Form (2NF): Find Partial Dependencies on Composite Keys
What does “the whole key determines it” mean?
A functional dependency X → Y means that, under a business rule, equal X values must imply equal Y values. Y depends fully on a composite X only if removing any attribute from X makes the dependency stop holding. If the dependency remains after removing part of X, it is partial.
An exact 2NF check needs every candidate key. Attributes that occur in any candidate key are prime; attributes in none are nonprime. The rule checks nonprime attributes. A chosen primary key may not be the only candidate key, so checking only it can miss a violation. The definition is about dependencies in the relation schema, not a few rows that happen to be in the current table.
Find a partial dependency in an inventory example
Assume the relation is INVENTORY(part, warehouse, warehouse_address, quantity) and the business rules are:
`warehouse → warehouse_address`: a warehouse code determines one address.
`(part, warehouse) → quantity`: there is one recorded quantity for each part at each warehouse.
The candidate key is (part, warehouse). Together they determine address and quantity, but warehouse alone determines the address. Therefore warehouse_address is a nonprime attribute partially dependent on part of the composite key, so the relation is not in 2NF. Under the stated rule, quantity requires the full part–warehouse pair.
If warehouse XYZ stores bolts and screws, its address is repeated in both inventory rows. Updating only one copy can make the same warehouse appear to have conflicting addresses; a warehouse without inventory cannot be recorded in this relation alone. The repeated address follows from storing two kinds of facts together.
Decompose the relations
Store warehouse facts separately from the inventory of each part at each warehouse. This PostgreSQL 18 DDL is illustrative:
CREATE TABLE warehouse (
warehouse_code text PRIMARY KEY,
warehouse_address text NOT NULL
);
CREATE TABLE inventory (
part_code text NOT NULL,
warehouse_code text NOT NULL
REFERENCES warehouse(warehouse_code),
quantity integer NOT NULL CHECK (quantity >= 0),
PRIMARY KEY (part_code, warehouse_code)
);
INSERT INTO warehouse (warehouse_code, warehouse_address)
VALUES ('XYZ', '20 Station Street');
INSERT INTO inventory (part_code, warehouse_code, quantity)
VALUES ('bolt', 'XYZ', 20), ('screw', 'XYZ', 30);
SELECT i.part_code, i.warehouse_code, w.warehouse_address, i.quantity
FROM inventory AS i
JOIN warehouse AS w USING (warehouse_code);The address now appears once in the warehouse relation; inventory stores one quantity per (part_code, warehouse_code). Primary keys enforce each relation’s key and the foreign key points inventory to an existing warehouse. The join reconstructs the fields needed for the original view. For the stated dependencies, the shared warehouse_code gives a lossless join, and each dependency is enforced in one relation. SQL is illustrative and was not executed.
A practical checking sequence
Confirm the relation is in 1NF.
Write functional dependencies from business rules, not from a few current sample rows.
Derive every candidate key, for example by attribute closure; do not assume the selected primary key is the only one.
Mark prime and nonprime attributes using all candidate keys.
For each composite candidate key, test whether a proper subset determines any nonprime attribute. One such dependency violates 2NF.
Move the determinant and its dependent fact into a separate relation. Verify that a join can recover the original facts and that important dependencies remain enforceable.
If all candidate keys are single-attribute, a conventional relation automatically satisfies 2NF: there is no proper nonempty subset of a key that could determine another attribute. A relation with no nonprime attributes also has no 2NF violation. Neither observation rules out redundancy or violations of other normal forms.
How is 2NF different from 3NF?
2NF addresses nonprime attributes that depend on only part of a composite candidate key. A relation with a one-column key can satisfy 2NF while still having A → B and B → C, causing C to repeat through B. That transitive dependency is a 3NF concern. Passing 2NF does not finish normalization.
Sources and scope
[University of Wollongong CSCI235: Database Normalization](https://documents.uow.edu.au/~jrg/235/slides/03databasenormalization/03databasenormalization.html)
[BCcampus, *Database Design* 3rd edition, Chapter 7](https://pressbooks.bccampus.ca/nelson/chapter/chapter07thirdedition/)
[PostgreSQL 18: Constraints](https://www.postgresql.org/docs/18/ddl-constraints.html)
Sources checked 2026-11-23. Normal-form definitions are in the relational-model scope. Warehouse dependencies are illustrative assumptions; SQL is PostgreSQL 18 syntax and was not executed.