Too bad sqlite doesn't have Oracle's ROWNUM:

"Pseudo-Columns

While not actual datatypes, Oracle supports several special-purpose
data elements. These elements are not actually contained in a table,
but are available for use in SQL statements as though they were part
of the table.
ROWNUM

For each row of data returned by a SQL query, ROWNUM will contain a
number indicating the order in which the row was retrieved. For
example, the first row retrieved will have a ROWNUM of 1, the second
row will have a ROWNUM of 2, and so on. This approach can be useful
for limiting the number of rows returned by a query. To display only
ten rows of the emp table, the following SQL statement makes use of
the ROWNUM pseudo-column:

SELECT *
FROM emp
WHERE ROWNUM < 11;

    WARNING:

    ROWNUM returns a number indicating the order in which the row was
retrieved from the table, but this is not always the order in which a
row is displayed. For example, if a SQL statement includes an ORDER BY
clause, rows will not be displayed in ROWNUM sequence, since ROWNUM is
assigned before the sort operation. "

Reply via email to