Created
September 2, 2017 23:54
-
-
Save EddyBorja/fc1d128561247f3d9fcec8879c51474a to your computer and use it in GitHub Desktop.
Example query for sorting an SQL table by average rating
This file contains hidden or 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
SELECT 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 some_table | |
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