*** 64,69 **** --- 64,81 ---- *: MEDIAN and standard deviation... are they standard? Essential for sqlite standalone executable for shell script users. + _:_MEDIAN is difficult because it cannot be done "on-line," i.e., on a stream of data. Following is a solution to MEDIAN credited to David Rozenshtein, Anatoly Abramovich, and Eugene Birger; it is explained_ + <HTML><A href="http://www.oreilly.com/catalog/transqlcook/chapter/ch08.html">here</A></HTML> + + SELECT x.Hours median + FROM BulbLife x, BulbLife y + GROUP BY x.Hours + HAVING + SUM(CASE WHEN y.Hours <= x.Hours + THEN 1 ELSE 0 END)>=(COUNT(*)+1)/2 AND + SUM(CASE WHEN y.Hours >= x.Hours + THEN 1 ELSE 0 END)>=(COUNT(*)/2)+1 + *: join syntax (+) (-) like oracle has - _SQLite used to have this but it was removed because it is not standard SQL._ *RETURN IT BACK AGAIN, PLEASE!!!*