SQL statements that display only the first few data how to use select top in seven databases

Source: Internet
Author: User
Tags sybase database

  1. How to use Select top in seven types of databases
  2. 1. Oracle Database
  3. SELECT * from TABLENAME WHERE ROWNUM <= N
  4. 2. Infomix Database
  5. SELECT First N * from TABLENAME
  6. 3. DB2 Database
  7. SELECT *
  8. From (SELECT * row_number () + ({ORDER by COL1 DESC}) as ROWNUM from TABLENAME)
  9. WHERE ROWNUM <= N
  10. Or
  11. SELECT COLUMN from TABLENAME FETCH first N ROWS only
  12. 4. SQL Server Database
  13. SELECT TOP N * from TABLENAME
  14. 5. Sybase database
  15. SET ROWCOUNT N
  16. GO
  17. SELECT * from TABLENAME
  18. 6. mysql Database
  19. SELECT * from TABLENAME LIMIT N
  20. 7. FoxPro Database
  21. SELECT * TOP N from TABLENAME ORDER by COLUMN

SQL statements that display only the first few data how to use select top in seven 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.