Skip to content

Instantly share code, notes, and snippets.

@rbiswas4
Created January 8, 2018 16:49
Show Gist options
  • Save rbiswas4/98a0b22b4392dce3cf64fe0a03d3295d to your computer and use it in GitHub Desktop.
Save rbiswas4/98a0b22b4392dce3cf64fe0a03d3295d to your computer and use it in GitHub Desktop.
# sqlite has no function like std or var. This is a method of how it can be calculated
# assume we want to get the variance of the column fieldRA from the table Summary in a sqlite DB. In this case the following produces the variance
SELECT avg((SUMMARY.fieldRA - sub.a)*(SUMMARY.fieldRA - sub.a)) FROM Summary, (SELECT avg(fieldRA) as a FROM SUMMARY) AS sub;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment