Database normalization (concept)
Computer Science · Databases
Question 1 of 10
0A deletion anomaly occurs when:
Stuck? Read the explanation
Unlocks at a streak of 5 correct answers in a row.
Embed this practice on your site or class page
Paste this HTML into your page. Students practise right there; it is free and needs no account.
Database normalization (concept) explained
Database normalisation is the process of organising tables so that each fact is stored in one place only. Repeated data wastes space, and it causes errors when one copy is updated but another copy is left out of date.
Normalisation is usually described in stages called normal forms. In first normal form, each cell holds one value and there are no repeating groups. Second and third normal forms remove columns that depend only on part of the key, or on another non-key column. For example, an Orders table that holds the customer's name and address on every order row would be split into a Customers table and an Orders table, linked by a CustomerID.
A common mistake is to think the smallest possible tables are always best. Heavily split tables mean many JOINs in every query, so designers sometimes keep some repeated data on purpose to make queries faster.
Worked example
A table of orders stores the customer's address on every order row. It holds 5 orders: Ali placed 3 and Bea placed 2. If Ali moves house, how many address values must be changed before and after normalising?
- Before: the address is repeated on each of Ali's 3 order rows, so 3 values must be changed.
- After: the address is stored once in a Customers table, so only 1 value must be changed.
- The saving is updates, and no copies can be left out of date.
Check: orders in the original table.
What you will practise
104 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.
Example questions
- Normalisation:
- Redundancy means:
- First normal form requires:
- Normalisation prevents:
- Denormalisation trades:
- A primary key is:
- A foreign key is:
- In normalisation, an anomaly is:
…and 96 more.