Eli5: Database Normalization

127 views

Every time I think I got it, I’m getting lost along the way. Please help!

In: 1

4 Answers

Anonymous 0 Comments

If you prefer answers in video form, [this](https://www.youtube.com/watch?v=GFQaEYEc8_8) one does a great job.

It is possible for a database to store data that is incorrect. Some incorrect data cannot be protected against just by designing the database better, but some errors can be prevented through good database design.

For example, if a database is storing usernames and passwords (hashed, hopefully) then it shouldn’t save two passwords for the same user. Users have only one password, so if the database is storing two passwords for them then that is *always* an error. It would be best to catch that error as close to where it happens as possible so that it can be fixed, rather than just letting the problematic code keep running until every user has a bunch of passwords stored.

Normalization is a set of rules that you can follow that help to prevent that sort of logical inconsistency within a database. It is broken down into levels, named as 1st Normal Form (1NF) up to 5th Normal Form (5NF). Each normal form imposes some extra rules on top of the one that came before it. 1NF is the weakest with 5NF the strongest.

The above linked video goes through each of the normal forms with clear and simple examples to call out scenarios where breaking the normal forms could lead to inconsistencies in data.

You are viewing 1 out of 4 answers, click here to view all answers.