Paging query statements for various databases

Source: Internet
Author: User

1.oracle Database Paging

1 Select *  from (Select A.*fromwhere rownum<=where a.rc>= StartRow


2.DB2 Database Paging

1 Select *  from (Select over as rc,a.)* from (select*from  orderby aswherebetween and Endrow


3.SQL Server 2000 Database Paging

1 Select Top *  from where  not  inch (selecttop pagesize*  from Order  by Order  By column name


4.SQL Server 2005 Database Paging

1 Select *  from (Selectover,orderby as  where t. Column Name 1  >= and T. Column name 1<=endrow


5.MySQL Database Paging

1 Select *  from table name limit startrow,pagesize 2 (pagesize the number of records displayed per page)


6.PostgreSQL Database Paging

1 Select *  from table name limit pagesize,offset StartRow 2 (pagesize the number of records to display per page.)


7. Common mode

1 Select *  from Select *  from where  not inch (Selectfromwhere rownum<=(currentpage-1) * where <=pageSize;



Paging query statements for various databases

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.