I'm having a debate with a co-worker whether or not I need to
normalize this situation.
I have an "Artist" table.
I have an "Album" table.
I then have a "Style" table.
We have some simple many-to-many tables inbetween, linking to Style:
"Artist_Sty le" table,
"Album_Styl e" table.
This allows an artist to have as many styles as it wants, and the
style table can have as many artists contain a style. Same with album.
The debate is whether or not the 2 reference tables should be merged
into one. They are exactly the same structure -- except that one has
an "album_id" field instead of a "artist_id" field. This means we need
to make a generic "parent_id" field. But we can't do this because the
id's aren't globally unique. Artist_id=00001 exists, and so does
Album_id=00001.
So the only solution would be to add another field called "type_id"
and then a type table where:
type_id = 1 = artist
type_id = 2 = album
I don't see any benefit from doing this except fewer tables (we
actually could merge about 10 tables in different groups). But it
doesn't shrink the number of records, and does add an extra field (for
type_id)
What's the standard?
What should I do?
Thanks!
normalize this situation.
I have an "Artist" table.
I have an "Album" table.
I then have a "Style" table.
We have some simple many-to-many tables inbetween, linking to Style:
"Artist_Sty le" table,
"Album_Styl e" table.
This allows an artist to have as many styles as it wants, and the
style table can have as many artists contain a style. Same with album.
The debate is whether or not the 2 reference tables should be merged
into one. They are exactly the same structure -- except that one has
an "album_id" field instead of a "artist_id" field. This means we need
to make a generic "parent_id" field. But we can't do this because the
id's aren't globally unique. Artist_id=00001 exists, and so does
Album_id=00001.
So the only solution would be to add another field called "type_id"
and then a type table where:
type_id = 1 = artist
type_id = 2 = album
I don't see any benefit from doing this except fewer tables (we
actually could merge about 10 tables in different groups). But it
doesn't shrink the number of records, and does add an extra field (for
type_id)
What's the standard?
What should I do?
Thanks!