Normalising data Normalisation is a technique used to reduce the duplication of data in a relational database. It helps to: • organise data in an efficient way • remove redundant (duplicated) data • make sure that only related data is stored in a table. Advantages • Storage capacity needed may be smaller • Database is easy to search as there are no duplicates • If data is amended in an entry, this amends all matching entries • Integrity of data is increased Disadvantages • The process is very complex • The process of searching the database may be slower, as a normalized database requires greater usage of CPU Un-normalised Form (0NF or UNF) If a database is not normalised it is called an un-normalised database, often shortened to 0NF or sometimes UNF. This is often a flat-file database (a single table) that contains duplicated data (which is called redundant data) and complex data structures (more than one item of data, otherwise known as nonatomic data) stored within a single field. Un-normalised Form (0NF or UNF) First Normal Form (1NF) The rules for a database normalised to 1NF are: • All data is stored in a database table. • A unique key must exist in each table (often a primary or compound key). • Only atomic data is stored (which is data stored to the lowest level of data and cannot be broken down any further). • Each field has a unique name. • Each record is unique (so there are no repeated rows in any table and a primary/compound key exists in each table). • There are no repeating groups of columns. First Normal Form (1NF) Why is this data in First Normal Form (1NF) and not in Second Normal Form (2NF)? This data is not in 2NF because the: • Subject, Teacher or Room fields are not dependent on the St_ID field • Forename, Surname or House fields are not dependent on the Course_ID field. Second Normal Form (2NF) • The rule for a database normalised to 2NF is that the table must be in 1NF and any non-key attributes that only depend on part of the table key are placed in a new table. Second Normal Form (2NF) Why is this data in Second Normal Form (2NF) and not Third Normal Form (3NF)? • This data is not in 3NF, because the Teacher and Room fields are dependent on each other, as each teacher always teaches in the same room Third Normal Form (3NF) • The rule for a database normalised to 3NF is to make sure that any non-key attributes that are more dependent on other non-key attributes than the table key, are removed to a new table. Third Normal Form (3NF)