LIMIT, SELECT TOP AND ROWNUM Keyword
The LIMIT, SELECT TOP, and ROWNUM keywords are used to specify the number of rows to return.
The Limit keyword is used in MySql, Select Top Keyword is used in SQL Server, and the Rownum keyword is used in Oracle.
LIMIT
The Limit keyword is used in MySql.
Syntax
SELECT * FROM <TABLE_NAME> LIMIT <VALUE>
Example
SELECT * FROM Employee LIMIT 5
SELECT TOP
The Select Top keyword is used in SQL Server.
Syntax
SELECT TOP <VALUE> * FROM <TABLE_NAME>
Example
SELECT TOP 5 * FROM Employee
ROWNUM
The ROWNUM keyword is used in Oracle.
Syntax
SELECT * FROM <TABLE_NAME> WHERE ROWNUM <= <VALUE>
Example
SELECT * FROM Employee ROWNUM <= 5
In all the above examples, all queries will return the first 5 records from the employee table.
Summary
All three keywords are used to specify the number of rows to return.