We have a database, which keeps informations about music – we have e.g. table for artists, bands, songs, albums etc. The next step is to allow users to rate those things, using 10-point grading scale.
What is the best way to remember all of users ratings? Surely I can create simple table, that contains user_id, rating_value and rated_thing_element, but obviously I can’t join it to EVERY table.
Is it better then, to create, for example, one table called ratings and few additional tables, like ratings_albums, ratings_songs, ratings_bands etc. to bind, or maybe just few ratingsXXX tables for each of elements I’ve mentioned above?
I’m not sure which way I should go… or does it really matter.=?
My personal preference is to go with a normalized table and strict foreign references. So I would use artist_ratings, album_ratings, and song_ratings tables. To make queries easier, I would create views to represent the most often joined tables.
You can use a ratings table with no foreign keys (well except for the user reference), but you lose referential integrity enforcement. This table would be