12-01-2007, 07:51 AM
|
#3 (permalink)
|
|
The Contributor
Join Date: Apr 2005
Location: Kent, UK
Posts: 54
Thanks: 0
|
Not really a good example.
genre_name will be unique, so then adding a unique id to it in the seperate table forces a join when you wish to return the value of genre_name in a query, as well as storing unnecessary information. Besides when entering data into the movie table, what makes more sense - genre = 7 or genre = comedy ? (Although the user may never see the id of course, depending on your interface)
And you missed out the link table - movie_genre (mid, genre) where mid is movie's id and genre is the different genres that a single movie may belong to EG a single movie could be comedy, and action, and Japanese. As this would be a multi-valued column, this is one important reason why it requires normalisation.
table schema: movie--<movie_genre>--genre
Normalisation should be done based on functional dependancies to remove redundant repetative data and multi-valued data (although a little de-normalisation certainly helps at times).
|
|
|
|