English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

SQL SELECT TOP, LIMIT and ROWNUM Keyword Usage and Examples

SQL Keyword Reference

SELECT TOP, LIMIT, and ROWNUM

The SELECT TOP command is used to specify the number of records to return.

Note:Not all database systems support SELECT TOP. MySQL uses LIMIT, while Oracle uses ROWNUM.

The following SQL statement selects the first three records from the 'Customers' table:

 SELECT TOP 3 * FROM Customers;

The following SQL statement shows an equivalent example using the LIMIT clause:

SELECT * FROM Customers LIMIT 3;

The following SQL statement shows an equivalent example using ROWNUM:

SELECT * FROM Customers
WHERE ROWNUM <= 3;

SQL Keyword Reference