The LIMIT, SELECT TOP, or ROWNUM command is employed to specify the number of records to be returned.
Please note that SQL Server employs SELECT TOP, MySQL utilizes LIMIT, and Oracle uses ROWNUM. |
The subsequent SQL statement retrieves the first three records from the “Customers” table (for SQL Server):
SELECT TOP 3 * FROM Customers; |
The following SQL statement demonstrates the equivalent example using the LIMIT clause (for MySQL):
SELECT * FROM Customers LIMIT 3; |
The following SQL statement illustrates the equivalent example using ROWNUM (for Oracle):
SELECT * FROM Customers WHERE ROWNUM <= 3; |