Second Normal Form (2NF)
2NF imposes two constraints on the database
- Database is in 1NF
- Any non-PK columns are dependent on the whole primary key
The first condition illustrates that normalization is hierarchical; being normalized to a later level requires normalization at all of the lower levels, true of the current state of our database, now with two tables. The second condition means that in cases with a compound primary key, any columns which are not part of the primary key must depend on the entire primary key, not just part of it. It is this condition which our database fails to achieve; the weatherstation_location column in Measurements clearly only depends on the identity of the weatherstation itself, as given by weatherstation_name and which is only part of the primary key. This will drive us to create a Weatherstations table.
Note that as the Instruments table has a single-column primary key, it will be 2NF if it's 1NF because the other fields all depend on the entirety of the primary key by construction. So, our new database layout looks like this:
Our course of normalization will end at 3NF; we have only one more step to complete!