I am using an MVC pattern to represent a table with many records of music albums. To each music album there are attributes (genre, artist, ratings, etc). Each attribute can have multiple values (so the genre of one album can be both "pop" and "latin", for example). I want to represent those attribute values using table(s).
So there are two basic approaches that I can think of. I wonder which approach is better?
Have a separate table for each attribute (e.g.,
GENRE
,ARTIST
). The columns in each table will be album_id and attr_value.Have a single table
ATTRIBUTES
which will also include, in addition to the album_id and value, the attribute name ("genre", "artist", ...).
Typically I would opt for method 1 (relational DB and all that), but if I choose method 2, my thought is that when I want to add a new attribute, I don't need to create a new model, controller, and view.
Any opinions? Thanks!