harbor run -t LiteCoder/sqlite-stats-extensionharbor download LiteCoder/sqlite-stats-extensionCreate a loadable SQLite extension in C that provides three aggregate statistical functions: median, mode, and stdev (standard deviation). The extension must be compiled as a shared library and be loadable into SQLite.
Makefile at /app/Makefile/app/stats_ext.c/app/stats_ext.so (shared library)/app/test_stats.sqlmake in /app must produce stats_ext.so without errorsAll three functions are aggregate functions that operate on a group of numeric values passed via SQL queries.
median(X) — Returns the median value of all non-NULL values in the group.
mode(X) — Returns the mode (most frequently occurring value) of all non-NULL values in the group.
stdev(X) — Returns the population standard deviation of all non-NULL values in the group.
sqrt(sum((xi - mean)^2) / N)0.0 if only one non-NULL value exists./app/test_stats.sql)The test script must:
test_data with at least a column value REAL.median(value), mode(value), and stdev(value) on the table.sqlite3 < test_stats.sql (after loading the extension).The shared library must export the standard SQLite extension entry point so it can be loaded with:
.load ./stats_ext