Summary
Keywords
Full Transcript
Database normalization is a database schema design technique to minimize redundancy and dependency of data. It’s not good to have redundancy in a database. For example, If you make changes to some data, you need to find all occurrences or copies of it and update it as well. So you don’t want a table with multiple rows all having the same data. Normal forms are the rules for creating less redundancy in your database tables. There are 6 normal forms, numbered 1 through 5, and the 3rd normal form has an improved version called the Boyce-Codd normal form, which removes all dependencies on non-unique columns. We will cover the first 3 normal forms. The First normal form (1NF) has the following rules for an organized database: - Define and place the required data items as columns in a table. - No repeating groups of data. - There is a primary key for each table The Second Normal Form should meet all the rules for 1NF and there must be no partial dependences of any of the columns on the primary key. We need to create a link between the two tables created from 1NF in order to make it 2NF. Even after putting your table in 2NF, it may still have some redundancy when a non-key column depends on another non-key column.. A table is in a third normal form (3NF) when it is in 2NF and it has no transitive-dependency for all the non-key attributes, which means nonprimary fields are dependent on the primary key. You cannot really compare 2NF and 3NF, since 3NF is just a more sophisticated case of 2Nf. Each normal gets more and more strict. Once you reach 3NF, you should have referential integrity. 3NF applies to non-key columns only, which may allow for occasional redundancy. If you want your database design to be golden, you should try to get it in Boyce-Codd normal form Boyce-Codd normal form applies to all columns and eliminates this redundancy, rather than to just non-key columns. There are also fourth and fifth normal forms which remove additional types of redundancy, but these redundancies are uncommon and of little practical concern. Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
