What is database normalization? Explain 1NF, 2NF, 3NF and BCNF.
What is database normalization? Explain 1NF, 2NF, 3NF and BCNF.
Normalization organizes tables so each fact is stored once. It removes redundancy and prevents update, insert and delete anomalies. The usual summary for 3NF: every non-key column depends on the key, the whole key, and nothing but the key.
| Form | Rule | Violation example |
|---|---|---|
| 1NF | Atomic values, no repeating groups, each row identifiable | phones = '555-1, 555-2' in one column |
| 2NF | 1NF + no partial dependency on part of a composite key | key (order_id, product_id) but product_name depends only on product_id |
| 3NF | 2NF + no transitive dependency between non-key columns | employee(id, dept_id, dept_name): dept_name depends on dept_id |
| BCNF | Every determinant is a candidate key | (student, course, teacher) where each teacher teaches one course: teacher -> course, yet teacher is not a key |
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.