SQL statement for querying by page in Oracle Database
Query SQL statements by page in the oracle database tutorial
Oracle
Select *
From (select rownum r, t1. * from table name t1 where rownum <m + n) t2
Where t2.r> = m
For example, to retrieve 10 or 20 records from the table sys_option (primary key: sys_id), the statement is as follows:
Select *
From (select rownum r, t1. * from sys_option where rownum <30) t2
Where t2.r> = 10
Mysql tutorial
Select * from table name limit m, n
Retrieve 10 or 20 records from the table sys_option (primary key: sys_id)
Select * from sys_option limit 10, 20
Sqlserver
Obtain n records starting from the m record in the database table. Use the keyword top: It is worth noting that if the select statement contains both top and order, select from the sorted results:
Select *
From (select top n * from
(Select top (m + N-1) * from table_name order by primary key desc) tbl_1) tbl_2
Order by primary key asc
Example here :( retrieve 10 or 20 records from the table sys_option (primary key is sys_id)
Select *
From (select top 20 *
From (select top 29 * from sys_option order by sys_id desc) t1) t2
Order by sys_id asc