SQLite Forum

Ask for new feature: a pre-decoder mechanism for 'variables' and 'stdev' ?

Ask for new feature: a pre-decoder mechanism for 'variables' and 'stdev' ?

(1) By stonebig on 2021-08-15 16:23:45 [source]

Would it be an option to have a pre-decoder stage in SQLite, that would reduce the workarounding to manage 'stddev' and 'variables' ?

- standard deviation:
  . "stdev(x)" math function is manually workarounded by replacing it by  "sqrt((sum(x * x) -2* sum(x) * avg(x) + avg(x) * avg(x) * count( * ))/count( * ))"

- "variables": methods like the one describe in Stackoverflow seems also to be a candidate for a pre-decoder https://stackoverflow.com/questions/7739444/declare-variable-in-sqlite-and-use-it/14574227#14574227

Sorry if this suggestion has already been made 42 times.

(2) By Donald Griggs (dfgriggs) on 2021-08-16 18:28:52 in reply to 1 [link] [source]

If I'm understanding 'pre-decoder stage' correctly, maybe one of these is relevant:

Sqlite now supports CTEs (WITH clause) which may help you concisely define a function. https://www.sqlite.org/lang_with.html

For basic statistics functions, note the contribution of extension-functions.c at https://sqlite.org/contrib/

Should you be using the CLI (command line interface utility program), it does indeed support named parameters. https://www.sqlite.org/cli.html#sql_parameters