Question

I have a table that has an attribute category. E.g a table where I save songs which has an attribute Genre:

Songs(
ID (INT), 
Name (STRING), 
Genre: (STRING)
)

Is the table in 3rd normal form?

I mean I know it is better to save the Genrein another table and the have a relationship between tables like:

Songs(
ID (INT), 
Name (STRING), 
Genre_ID: (INT)
)

Genre(
ID (INT),
Name (String)
)

where Songs.Genre_ID = Genre.ID.

But I can not determine if the first case (with one table) does violate any rule of 3rd normal form!

Does it? If yes, which one?

Thanks, Mike

Was it helpful?

Solution

What are the keys? What dependencies is the table supposed to satisfy? Those are the things we need to know to answer your question.

My guess is that ID is the only key and that ID->{Name,Genre} and that there are no other non-trivial, non-key dependencies. If that's correct then Songs is in 3NF. More importantly it is in BCNF and 5NF.

Replacing the string attribute Genre with an integer Genre_ID has absolutely nothing to do with any normal form.

OTHER TIPS

Repeat after me.

"ID numbers have nothing to do with normalization. ID numbers have nothing to do with normalization. ID numbers have nothing to do with normalization."

If your goal is to store one genre per song name, then this table

song_name           genre
--
Toxic               Pop
Itsy Bitsy Spider   Children's

where song_name is the primary key, is in 5NF. (And 4NF, and 3NF, and so on).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top