you are at >> normalization >>2nd normal form
2nd normal form
Relation (table) is in 2NF if
- is in 1NF
-
if every attribute of that relation which is not part of any potential key
is fully functional dependent on all sub-relations of primary key
id | date | receiver id | receiver surname | deliverer name | deliverer address |
1 | 12th December | 3 | Nowak | FastTrans | Wadowice |
2 | 14th December | 4 | Nowak | Guliwer | Warszawa |
table in 1NF
At above table primary key is `id`, `receiver_id`, `deliverer_name` and no attribute is fully functional dependent from
primary key.
- `receiver_surname` depends on `receiver_id`
- `deliverer_address` depends on `deliverer_name`
To normalize above relation to 2NF we have to divide it into following tables:
id | date | receiver_id | deliverer_name |
1 | 12th December | 3 | FastTrans |
2 | 14th December | 4 | Guliwer |
sub-relation with deliverers at 2NF
receiver_id | receiver_surname |
3 | Nowak |
4 | Nowak |
sub-relation with receivers at 2NF
receiver_name | receiver_address |
FastTrans | Wadowice |
Guliwer | Warszawa |
sub-realtion with deliverers at 2NF
Above sub-relations may be joined together logically through foreign keys.
[ wróć na górę strony ]