In the Database Table, the primary key is made up of the MemberID and the
DatabaseID. This makes sense for other attributes like "Where Learned" and
"Skill Level" attributes, since they will be different for every member/database
combination. But the database name depends only on the DatabaseID. The same
database name will appear redundantly every time its associated ID appears in
the Database Table.
Suppose you want to reclassify a database - give it a different DatabaseID.
The change has to be made for every member that lists that database! If you miss
some, you'll have several members with the same database under different IDs.
This is an update anomaly.
Or suppose the last member listing a particular database leaves the group.
His records will be removed from the system, and the database will not be stored
anywhere! This is a delete anomaly. To avoid these problems, we need second
normal form.
To achieve this, separate the attributes depending on both parts of the key
from those depending only on the DatabaseID. This results in two tables:
"Database" which gives the name for each DatabaseID, and "MemberDatabase" which
lists the databases for each member.
Now we can reclassify a database in a single operation: look up the
DatabaseID in the "Database" table and change its name. The result will
instantly be available throughout the application.
|