A quick note on adding two columns with X and Y values in a vector layer in spatialite. Spatialite stores the information about the geometry in binary format in the ‘Geometry’ field.
You can use the Spatialite function AsText() to convert and extract these values as a Well Known Text (WKT), which is an easy to read format. If you for example have a spatial table ‘Waypoints’ with two columns ‘PKUID’ and ‘Geometry’, you can extract a column with WKT values using:
SELECT AsText(Geometry) FROM Waypoints
This gives you a column with values that look like ‘MULTIPOINT(X-coordinate, Y-coordinate)‘.
To extract the X and Y values separately, you can use the functions X() and Y(). The following SQL statement creates a new table ‘Waypoints2’ with the column ‘PKUID’ and two columns X and Y that hold the X and Y coordinates respectively.
CREATE TABLE 'Waypoints2' AS SELECT PKUID, X(Geometry) as X, Y(Geometry) as Y FROM Waypoints
For more information, see this spatialite tutorial.