Oracle MySQL DB2 SQL paging Oracle
, MySQL
, DB2
, SQL
, Pagination
Oracle
- Select * from (select rownum, name from user_tables where rownum <= endindex)
- Where rownum> startindex
If order is added, it will be more troublesome.
- Select * from (select rownum, name from user_tables order by orderstr) Where rownum <= endindex
- And rownum> startindex
MySQL is the simplest Limit
- Select * from table where whereclause order by orderstr limit start, pagenum
DB2
Use rownumber over and fetch first rows only
- Select
* From (select syscat. Indexes. *, rownumber () over () rownum from Syscat. indexes where owner = 'db2inst1' order by indname DESC fetch first 100 rows only) Where rownum <20 and rownum> = 15
- Db2inst1 SQL
100805143603630 db2inst1 15
- Db2inst1 sql100805143558190 db2inst1 16
- Db2inst1 sql100805143558150 db2inst1 17
- Db2inst1 sql100805143558100 db2inst1 18
- Db2inst1 sql100805143557870 db2inst1 19
|
*********************************** *****
The primary key automatically generated by ibatis returns the primary key (Oracle, SQL Server, MySQL)
DB2 SQL stored procedure syntax official authoritative guide
Ask for an oracle SQL query (Thank you for your answers)
Quick query of Oracle SQL syntax. CHM
Comparison between Oracle and SQL Server