Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standard Deviation for SQLite

I've searched the SQLite docs and couldn't find anything, but I've also searched on Google and a few results appeared.

Does SQLite have any built-in Standard Deviation function?

like image 669
Alix Axel Avatar asked Feb 19 '10 17:02

Alix Axel


People also ask

How do you find the standard deviation in SQL?

To calculate the sample standard deviation, you use the STDDEV_SAMP (expression) function. MySQL also provides some functions for population variance and sample variance calculation: VAR_POP(expression) – calculates the population standard variance of the expression.

How many records can SQLite handle?

The theoretical maximum number of rows in a table is 264 (18446744073709551616 or about 1.8e+19). This limit is unreachable since the maximum database size of 281 terabytes will be reached first.


1 Answers

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.

like image 82
Anonymous Avatar answered Sep 20 '22 22:09

Anonymous