Original address: http://www.cnblogs.com/ginponson/p/5746435.html
Assuming that this is page pageno, there are pagesize records per page, and now the student table is queried using MySQL, Oracle, and SQL Server paging.
Paging Query for 1.Mysql
SELECT * from Student -1* pagesize,pagesize;
Understanding: (Limit n,m) + starts from the nth line to fetch M Records, n from 0 to calculate.
Paging Query for 2.Oracel
select * From ( select ROWNUM RN, * from student where Rownum <= pageno * pageSize) where RN > (pageno - 1 ) * pageSize
Understanding: Suppose PageNo = 1,pagesize = 10, first take the row number less than or equal to 10 from the student table, and then remove the RN greater than 0 records from these records, so as to achieve paging purposes. RowNum starting from 1.
3.SQL Server Paging Query
select top PageSize * from ( select Row_number () over (order by ID asc ) RowNumber, * from student) A where A.rownumber > (pageno -
1 ) * PageSize
Understanding: Suppose PageNo = 1,pagesize = 10, sort by the ID of the student table first, rownumber as the line number, and then take out 10 records starting at line 1th.
Paging query statements for MySQL, Oracle, and SQL Server