We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

First Normal Form (1NF)

To be compliant with first normal form (1NF for short), a database table simply needs to follow two rules:

  • It must have a unique primary key.
  • A cell can't have a nested table as its value (depending on the database system you're using, this may not even be possible).

Example of Not 1NF

name age email
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.

Example of 1NF

The simplest way (but not the only way) to get into first normal form is to add a unique id column.

id name age email
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.

Almost Always Adhere to 1NF

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.

Assignment

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.