Answer the question
In order to leave comments, you need to log in
How to properly design a music awards database?
Trying to design a music awards database: link .
There is a problem with the win and nominees fields. How to normalize them? I say right away that I read books and I successfully normalized the rest of the site modules, but somehow it doesn’t work, and if it works, then a lot of queries to the database turn out to be not good.
Answer the question
In order to leave comments, you need to log in
Is the set of winners a subset of the nominees? I would then make a table of nominees:
* user_id
* nomination_id - nomination ID
* win - boolean value, won or did not win.
The primary key is a pair of user_id+nomination_id
And finally, if everything is normalized for you, this does not mean that there will be few requests and it will work efficiently. To work effectively with the database, on the contrary, denormalization is often specially carried out.
Table `nominees` with fields `id_actor`, `id_award`, `is_win` - respectively, who was nominated, what award was nominated for, whether he won. And it is necessary to look at requests, usually everything is solved through JOIN'y.
So if it's complicated, maybe you don't need to normalize them? Often, on the contrary, denormalization of the database is done to improve the performance of the application. And data integrity is guaranteed in application models.
1) Do you need an awards table at all? Is it possible to make an object of type Enumeration with clogged constants?
2) According to the nomination table:
- type - the same enum
- win - as I understand it, if it is id, then int
- nominees - this can be normalized with the link nomination.id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question