Oracle MySQL DB2 SQL Paging

Source: Internet
Author: User
Oracle MySQL DB2 SQL paging Oracle
, MySQL
, DB2
, SQL
, Pagination
Oracle

  1. Select * from (select rownum, name from user_tables where rownum <= endindex)
  2. Where rownum> startindex


If order is added, it will be more troublesome.

  1. Select * from (select rownum, name from user_tables order by orderstr) Where rownum <= endindex
  2. And rownum> startindex


MySQL is the simplest
Limit

  1. Select * from table where whereclause order by orderstr limit start, pagenum


DB2

Use rownumber over and fetch first rows only

  1. 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


  1. Db2inst1 SQL
    100805143603630 db2inst1 15
  2. Db2inst1 sql100805143558190 db2inst1 16
  3. Db2inst1 sql100805143558150 db2inst1 17
  4. Db2inst1 sql100805143558100 db2inst1 18
  5. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.