DB Normalization - vijayetar/seattle-301d55 GitHub Wiki
Database normalization
is a process used to organize a database into tables and columns.
The idea is that a table should be about a specific topic and that and only supporting topics included.
By limiting a table to one purpose you reduce the number of duplicate data contained within your database. This eliminates some issues stemming from database modifications .
Database table is where all the data in a database is stored, and without tables, there would not be much use for relational databases.
Each row in a relational is uniquely identified by a primary key. This can be by one or more sets of column values. In most scenarios it is a single column, such as employeeID.
No two rows can have the same primary key value.
A column is defined by its name and data type. The name is used in SQL statements when selecting and ordering data, and the data type is used to validate information stored.
Tables should have one purpose. Having the table serve many purposes introduces many of the challenges; namely, data duplication, data update issues, and increased effort to query data.
DB normalization helps
- Prevent data duplication
- Database normalization fixes modification anomalies - insert / update / deletion
- search and sort your data
There are three common forms of database normalization: 1st, 2nd, and 3rd normal form. They are also abbreviated as 1NF, 2NF, and 3NF respectively.
1st Normal Form
When the data is in a database table. The table stores information in rows and columns where one or more columns, called the primary key, uniquely identify each row. Each column contains atomic values, and should be not repeating groups of columns.
2nd Normal Form
The table is in 1st normal form, and All the non-key columns are dependent on the table’s primary key.
3rd Normal Form
A table is in third normal form if:
A table is in 2nd normal form. It contains only columns that are non-transitively dependent on the primary key