Last active
November 3, 2016 22:48
-
-
Save laguiar/22e7df937f3f68bb465612853c1a3088 to your computer and use it in GitHub Desktop.
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
-- From the Evan Miller's article http://www.evanmiller.org/how-not-to-sort-by-average-rating.html | |
SELECT widget_id, ((positive + 1.9208) / (positive + negative) - | |
1.96 * SQRT((positive * negative) / (positive + negative) + 0.9604) / | |
(positive + negative)) / (1 + 3.8416 / (positive + negative)) | |
AS ci_lower_bound | |
FROM widgets | |
WHERE positive + negative > 0 | |
ORDER BY ci_lower_bound DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment