Normalisation Flashcards
partial dependency
occurs when a non-key attribute is functionally dependent on, or determined by, a single attribute that is part of a composite primary key. Requires composite primary key.
transitive dependecy
occurs when a non-key attribute determines another non-key attribute but it can be skipped over because the primary key already uniquely identifies that specific attribute.
1NF
First Normal Form. Describes the state of a database where all tables are free from repeating groups
repeating groups
cells in the table are left blank because they would be repeats of the line above it. Only the cells in those columns which have values that differ from the row above are filled in. Multiple entries of the same type existing for any single key attribute occurrence.
2NF
Second Normal Form. Occurs only when 1NF contains composite primary keys. Achieved when all tables are in 1NF and partial dependencies are removed.
3NF
Third Normal Form. Achieved when all tables are in 2NF and transitive dependencies are also removed.
BCNF
Boyce Codd Normal Form. This normal form is a special type of 3NF which occurs only when the tables have determinants with more than one candidate key. A table is already in BCNF if it is in 3NF and there are no determinants of key attributes that are non-key attributes.
4NF
Fourth Normal Form. Achieved when all multivalued-dependencies are removed. Useful for taking information from spreadsheets and creating a database since a spreadsheet is likely to have multivalued dependencies in it.
conversion to 1NF
- Eliminate repeating groups
put data in table
each cell should have single value
each entity occurrence should have a value for every attribute unless nulls allowed - Identify the primary key
must u n i q u e l y identify every row - Identify all dependencies
conversion to 2NF
- Make new table for every primary key attribute in a composite key to eliminate partial dependency. Keep all key-attributes in original table.
- Reassign corresponding attributes to a new table based on which key-attribute they were dependent on.
- Name the tables appropriately
- Make the determinants foreign keys in the original table.
conversion to 3NF
- Repeat process of 2NF but for transitive dependencies. For every transitive dependency create a new table with the determinant as the primary key in the new table and a foreign key in the original table.
- Remove dependent attributes from the original table
conversion to BCNF
Make determinant of prime attribute part of the primary key. Remove dependent from primary key. Leads to partial dependency. Remove partial dependency by normalising to 3NF.
conversion to 4NF
Multivalued dependency is eliminated through the creation of new tables for the components of the multivalued dependency.
advantages of normalisation
Reduced redundancy leads to fewer anomalies and information is therefore more accurate and reliable.
disadvantages of normalisation
Normalisation compromises processing speed to eliminate data redundancy and anomalies. Only necessary if the manner in which the data is likely to be manipulated/queried requires the separation. All choices to normalise are a trade-off between the needs of processing speed and reduced redundancy.