Standard Deviation for SQLite

You can calculate the variance in SQL:

create table t (row int);
insert into t values (1),(2),(3);
SELECT AVG((t.row - sub.a) * (t.row - sub.a)) as var from t, 
    (SELECT AVG(row) AS a FROM t) AS sub;
0.666666666666667

However, you still have to calculate the square root to get the standard deviation.


The aggregate functions supported by SQLite are here:

http://www.sqlite.org/lang_aggfunc.html

STDEV is not in the list.

However, the module extension-functions.c in this page contains a STDEV function.