Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you know when an SQL database needs more normalization?

Is it when you're trying to get data and there is no apparent easy way of doing it?

When you find something should be a table on it's own?

What are the laws?

like image 967
Sergio Tapia Avatar asked Nov 03 '09 14:11

Sergio Tapia


People also ask

When should you normalize a database?

Normalization is necessary to ensure that the table only contains data directly related to the primary key, each data field contains only one data element, and to remove redundant (duplicated and unnecessary) data.

How far should I normalize a database?

You want to start designing a normalized database up to 3rd normal form. As you develop the business logic layer you may decide you have to denormalize a bit but never, never go below the 3rd form. Always, keep 1st and 2nd form compliant. You want to denormalize for simplicity of code, not for performance.

What happens if a database is not normalized?

Without normalization, database systems can be inaccurate, slow, and inefficient and they might not produce the data you expect. We use the normalization process to design efficient and functional databases. By normalizing, we store data where it logically and uniquely belongs.

What are the three reasons to normalize a database?

Objectives of database normalizationTo prevent unwanted deletions of data. To optimize storage space. To reduce the delay when new types of data need to be introduced.


2 Answers

Check out Wikipedia. The article talks about database normalization and the different forms (first, second, third, etc.). Most times you should be aiming for at least third normal form. There are times when you want to relax the rules a bit (it may be too expensive to join multiple tables together so might want to de-normalize a bit) but for the most part third normal form is good.

like image 140
TLiebe Avatar answered Sep 21 '22 18:09

TLiebe


When you notice you have to repeat the same data, or when you start using single fields as arrays.

like image 40
Ikke Avatar answered Sep 20 '22 18:09

Ikke