Select every nth record from table
I would like to use Select to show every nth record in a table in order rather than all the records.
SELECT * FROM ( SELECT ROW_NUMBER() OVER (PARTITION BY 1) RowNum, * FROM t ) AS A WHERE (A.RowNum % n) = 0 ;
Edit: You need a version supporting Window functions, I think 3.26+ (unconfirmed)
NB: This is day 5 of my WFH self taught Sqlite3 class
While the previous suggestion will work for ANY SELECT query, if you are really only interested in the rows of a single table, and the table is a normal table (not a WITHOUT ROW_ID), then this would suffice:
SELECT * FROM t WHERE (rowid % n) = 0