Search code examples
phpmysqlmathlogic

Calculating overall rating


If i have a series of 10 objects with rating from 1 to 10. Then how can i calculate overall rating?

For example if i have a list like this:

Entertainment - 8/10
Fun - 9/10
Comedy - 6/10
Dance - 8/10

and so on... Like this 10 objects. Tell me how to calculate the overall rating for 10.

Overall - ?/10

I am very weak in maths. I was told by someone to add the total and if I got 83 as the answer, then the overall rating will be 8.3/10. Is this correct?

I am doing this for my PHP website. So if someone knows how to write a query for this, that would be very helpful for me.


Solution

  • Average the total rating and you will get the answer.

    he one that is told for will stand correct if there are 10 criteria on which scoring is to be made.

    SELECT avg(score) FROM tbl
    

    There is inbuilt function available for it Refer http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_avg