First define the several parameters that the paging statement will use:
int currentpage; Current page
int Pagerecord; Show number of records per page
Take the previous AddressBook datasheet for example (10 records per page):
One, Sqlserve download page statements
String sql = "SELECT top" +pagerecord + "* from AddressBook where ID is not in (select Top" + (currentpage-) *pagerecord + "id from T_user) ";
Second Page SQL Demo:
Select top of * from AddressBook where ID. (select top ID from addressbook)
Second, MySQL database paging statements
String sql = "SELECT * from AddressBook where limit" + (currentpage-) *pagerecord + ", +pagerecord +" ";
SELECT * FROM table name "condition" Limit m,n;
M to start with the first few records, such as the display of each page record, the second page must start from the first record
Second Page SQL Demo:
SELECT * from AddressBook where limit 10,10
Iii. Oracle Database Page-Splitting statements
Second Page SQL Demo:
SELECT * FROM (select RowNum rn,t.* from AddressBook where rownum<=) where rownum > 10
The above is a small set to introduce the Oracle, MySQL and sqlserve three kinds of database paging query statements of the difference, I hope to help!