

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Table Relationships
incomplete
2: One to Many
incomplete
3: Many to Many
incomplete
4: Database Normalization
incomplete
5: Normal Forms
incomplete
6: First Normal Form (1NF)
incomplete
7: Second Normal Form (2NF)
incomplete
8: Third Normal Form (3NF)
incomplete
9: Boyce-Codd Normal Form (BCNF)
incomplete
10: Normalization Review
incomplete
11: Query Practice – Users & Banks
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
To be compliant with first normal form (1NF for short), a database table simply needs to follow two rules:
| name | age | |
|---|---|---|
| Lane | 27 | [email protected] |
| Lane | 27 | [email protected] |
| Allan | 27 | [email protected] |
This table does not adhere to 1NF. It has two identical rows, so there isn't a unique primary key for each row.
The simplest way (but not the only way) to get into first normal form is to add a unique id column.
| id | name | age | |
|---|---|---|---|
| 1 | Lane | 27 | [email protected] |
| 2 | Lane | 27 | [email protected] |
| 3 | Allan | 27 | [email protected] |
It's worth noting that if you create a "primary key" by ensuring that two columns are always "unique together," that works too.
First normal form is simply a good idea.
I've never built a database schema where each table isn't at least in first normal form.
We hired an intern at CashPal and her first task was to design a new "companies" table. This table will store our business clients' data. Unfortunately, the intern has committed the unforgivable sin – there's no primary key on the table! We could have entire duplicate rows!
Add an id field as the first column. It should be an integer and have the PRIMARY KEY constraint. When you're done, the companies table will be in first normal form.