Answer the question
In order to leave comments, you need to log in
How to implement product rating?
Please tell me the algorithm for calculating the rating of a product from 5 "stars". How is the average value calculated?
Suppose we have 270 responses (5* - 124, 4* - 57, 3* - 37, 2* - 33, 1* - 19) the average is 3.9. How to get this number?
Or who has simpler rating calculation algorithms?
Answer the question
In order to leave comments, you need to log in
Found a solution. The number of votes for each "asterisk" is multiplied by the value of this "asterisk", then we sum up the obtained values and divide by the total number of votes.
AVG(expr)
Возвращает среднее значение аргумента expr:
mysql> SELECT student_name, AVG(test_score)
FROM student
GROUP BY student_name;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question