More Normalization Examples
More Normalization Examples
Example 1):
In the following relation, student can take many courses:
If the relation has a composite PK, then each non-key attribute must be fully dependent on
the entire PK and not on a subset of the PK (i.e., there must be no partial dependency or
augmentation).
For the second normal form, the relation must first be in 1NF. The relation is automatically
in 2NF if, and only if, the PK comprises a single attribute.
If the relation has a composite PK, then each non-key attribute must be fully dependent on
the entire PK and not on a subset of the PK (i.e., there must be no partial dependency or
augmentation).
AUTHORS
This relation’ primary key is author_id, single attribute so the relation is in 2NF.
Book → Author: Here, the Book attribute determines the Author attribute. If you
know the book name, you can learn the author's name. However, Author does not
determine Book, because an author can write multiple books. For example, just
because we know the author's name Orson Scott Card, we still don't know the book
name.
Author → Author_Nationality: Likewise, the Author attribute determines
the Author_Nationality, but not the other way around; just because we know the
nationality does not mean we can determine the author.
We can start by removing the Book column from the Authors table and creating a
separate Books table:
BOOKS
BOOKS table:
AUTHORS table:
COUNTRIES
Country_ID Country
Coun_001 United States
Coun_002 Canada
AUTHORS
Now we have three tables, making use of foreign keys to link between the tables:
The BOOK table's foreign key Author_ID links a book to an author in the
AUTHORS table.
The AUTHORS table's foreign key Country_ID links an author to a country in
the COUNTRIES table.
The COUNTRIES table has no foreign key because it has no need to link to
another table in this design.