Описание тега database-normalization
Database normalization is the process of organizing the fields and tables of a relational database to minimize redundancy and dependency. It is a procedure in relational database design, that presumably precludes certain undesirable properties from the database. The goal is to remove redundancy in the relations and the anomalities for insertion, deletion and update. Normalization involves decomposing a table into less reduncant, smaller tables without losing information. Defining foreign keys in the old tables referencing the primary keys of the new ones.
The Normal forms progress toward obtaining an optimal design. Normalization is step-wise process, where each step transorms the relational schemas into a higher normal form. Each Normal form contains all the previous normal forms and some additional optimization over them.
First Normal Form (1NF)
A relation is considered to be in 1NF if all of its attributes have domains that is indivisible or atomic. This means no repating groups. First normal form requires a separate line item with it's own key.
Second Normal Form (2NF)
A relation is in 2NF when is in 1NF and requiring that non-key attributes be dependent on "the whole key". In other words create separate tables for sets of values that apply to multiple records and relate these tables with a foreign key.
Third Normal Form (3NF)
A relation is in 3NF when it is in 2NF and requiring that non-key attributes be dependent on "nothing but the key". Values in a record that are not part of that record's key do not belong in the table.
Boyce Codd Normal Form (BCNF)Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with certain type of anamoly that is not handled by 3NF. A 3NF table which does not have multiple overlapping candidate keys is said to be in BCNF. For a table to be in BCNF, following conditions must be satisfied:
R must be in 3rd Normal Form
and, for each functional dependency (X -> Y), X should be a super Key.
Reference
- The Theory of Relational Databases - David Maier
- Description of the database normalization basics
- Litt's tips on normalization
Related Tags