Paging query statements for various databases

Source: Internet
Author: User

1. Oracle Database Paging Select* FROM (select A.*,rownum rc from table name where Rownum<=endrow) a where a.rc>=StartRow2. DB2 Database Paging Select* FROM (select RowNumber () over () as rc,a.* from (SELECT *From table name order BY column name) as a) where RC between StartRow and Endrow3. SQL Server 2000 database paging Select top pagesize* FROM table name where column name not in (select top pagesize*page column name from table name order BY column name) Order BY column name4. SQL Server 2005 Database paging Select* FROM (select column name, Row_ search number () over (Order by column name 1) as alias from table name) as T where T. Column name 1>=startrow and T. Column name 1<=Endrow5. MySQL Database paging Select*from table name limit startrow,pagesize (PageSize is the number of record bars displayed per page)6. PostgreSQL Database Paging Select*from table name limit Pagesize,offset StartRow (pagesize the number of record bars displayed per page.) 7. General Mode Select* FROM (SELECT * from tb_student where SID is not in (select Sid from Tb_student where rownum<= (currentPage-1) *pagesize)) where RowNum <=pageSize;

Paged query statements for various databases

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.