I need some help to figure out how to create a ranking system.

For example, let's take music albums, I want to create and maintain three different rankings on each album; ranking in all albums, ranking in genre and ranking of the artist's own albums.

I was considering two possible ways:

Firstly, creating a table with the rankings or adding it to the album table

Or

Secondly, calling three queries for each album with normal WHERE and ORDER BY parameters.

Which one is better, or is there another method?

有帮助吗?

解决方案

I would go for a table with rankings. What you are describing is called a 1:n (1:many) relationship. Your database should be normalized, so go for the extra table.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top