On Mar 27, 2012, at 9:02 PM, Simon wrote:

>  I would love to do an sql query that would look like the following ones.
> I wonder if they are possible and valid applications for SQL and what would
> be the proper implementation for these.

Generally speaking, analytical functions (aka windowing functions [1]) would 
appear to be the most useful for your endeavor.

Sadly, SQLite doesn't provide anything like this out-of-the-box.

> I think creating a module ... may be an idea… 

You can always create you own (aggregate) functions:

http://www.sqlite.org/c3ref/create_function.html

Here is some inspiration:

SQL for Analysis and Reporting
http://docs.oracle.com/cd/B28359_01/server.111/b28313/analysis.htm

And here are examples of custom functions, including stdev, variance, mode, 
median, lower_quartile, upper_quartile, etc:

http://www.sqlite.org/contrib/download/extension-functions.c?get=25


[1] http://en.wikipedia.org/wiki/Window_function_(SQL)#Window_function
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to