Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

general

What is the first normal form (1NF)?

Anusheh Zohair Mustafeez

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Normal forms

Normalization is the process of reducing redundancy from a set of relations. In database tables, we can use normal forms to carry out this process. The four main normal forms are:

As the figure below shows, these normal forms build upon one another progressively. In this shot, we will focus on the first normal form.

First normal form (1NF)

For a table to be in first normal form, it needs to satisfy the following conditions:

  • It should only have atomicmeans it cannot hold multiple values attributes/columns.
  • All values in a column should belong to the same domain.
  • All column names should be unique.
  • The order of data storage should not matter.

Now, let’s look at a concrete example of a table that is currently not in first normal form:

ID Person Number
1 Sultan 4324521, 5254326
2 Aasia 4924575
3 Farhan 9875325
4 Vafa 2468967, 7533678
5 Zakariya 4675379, 4646388

In the above example, the values in the Numbers column are not atomic. To decompose the table to the first normal form, we must make these values atomic. We can do this by allocating separate rows to each number, like this:

ID Person Number
1 Sultan 4324521
1 Sultan 5254326
2 Aasia 4924575
3 Farhan 9875325
4 Vafa 2468967
4 Vafa 7533678
5 Zakariya 4675379
5 Zakariya 4646388

RELATED TAGS

general

CONTRIBUTOR

Anusheh Zohair Mustafeez

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring