In Sqlite3, the structure of the top syntax is not used, and the Sqlite3 uses limit to achieve such a function.
The data in the MyTable table is as follows:
ID Value
1 Hello
2 You
3 You
4 Very Good
5 !
The following SQL statement: SELECT * FROM MyTable limit 3; The query results shown are:
1 Hello
2 You
3 You
Equivalent to top 3 in SQL Server, but limit has a more powerful function than top, especially in the paging feature.
The following SQL statement: SELECT * FROM MyTable limit 1, 3;
The results shown are:
2 You
3 You
4 Very Good
The limit m,n means starting with the first record and fetching N Records (starting from 0, and the 2nd record starting from 1, one analogy). Therefore, starting from the third record, then m=2, such as starting from the 6th record to fetch data, fetch 10, the SQL statement is as follows: SELECT * FROM MyTable limit 5, 10;