Вопрос

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