SQLite Forum

Recursive CTE
Login
Reducing the number of vertices, using Spatialite:

ST_Simplify: return a geometric object representing a simplified version of c applying the Douglas-Peukert algorithm with given tolerance

See for instance http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html