Last active
December 28, 2015 23:19
-
-
Save kakha13/7577820 to your computer and use it in GitHub Desktop.
100% cool rating system query for SQL that will give you right result. Score and Timer calculation Rating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- BY Kakha Giorgashvili (KAKHA13) | |
-- Rating system query | |
-- score = Users Score | |
-- timer = Interval from begining to end | |
-- 1.8 is gravity what helps query to get 100% right result | |
SELECT | |
*, | |
(`score` - 1) / POWER(`timer`, 1.8) AS rating | |
FROM | |
column_name | |
ORDER BY | |
rating DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment