Last active
May 28, 2019 14:31
-
-
Save luckyshot/aec660c5469c7d54dabe057802dacc0c to your computer and use it in GitHub Desktop.
Computing Average/Median value ignoring outliers/extremes (MySQL)
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
-- Exclude outliers while trying to get the average | |
SELECT AVG(price) FROM transactions WHERE ABS(price - (SELECT AVG(price) FROM transactions) < 3*(SELECT stddev(price) from transactions)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment