The previous answer assumes that the primary key identifier begins with 1. This would not be the case if the rows were deleted.
http://www.sqlite.org/lang_update.html : "If SQLite is built with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT compilation parameter, then the syntax of the UPDATE statement extends with the optional ORDER BY and LIMIT clauses ..."
In this case, you can use this simple query:
UPDATE table SET columns = 'value' WHERE 1 LIMIT n ORDER BY identifier ASC
Another suggestion may not be needed based on the default ordering scheme.
source
share