How several databases read the top N records

Source: Internet
Author: User
Tags rowcount

1. ORACLE Select * from TABLE1 Where rownum<=n

2. INFORMIX Select First N * from TABLE1 where 1=1

3. MYSQL Select * from TABLE1 where 1=1 LIMIT N

4. DB2

Select * Row_number () over (ORDER by COL1 DESC) as ROWNUM Where rownum<=n

or Select COLUMN from TABLE where 1=1 FETCH first N ROWS only

5. SQL SERVER

Select TOP N * from TABLE1 where 1=1

Or

Set ROWCOUNT N Select * from TABLE1 where 1=1 SET ROWCOUNT N1

6. SYBASE

Set ROWCOUNT N Select * from TABLE1 where 1=1 SET ROWCOUNT N1

7. FOXPRO

Select * TOP N from TABLE OrDER by COLUMN

8. ACCESS

Select TOP N * from TABLE1 where 1=1

How several databases read the top N records

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.