HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The LIMIT, SELECT TOP or ROWNUM command is used to specify the number of records to return
The LIMIT
, SELECT TOP
or ROWNUM
command is used to specify the number of records to return.
Note: SQL Server uses
SELECT TOP
. MySQL
uses LIMIT
, and Oracle uses
ROWNUM
.
The following SQL statement selects the first three records from the "Customers" table (SQL SERVER):
SELECT TOP 3 * FROM Customers;
The following SQL statement shows the equivalent example using the LIMIT clause (MySQL):
SELECT * FROM Customers
LIMIT 3;
The following SQL statement shows the equivalent example using ROWNUM (Oracle):
SELECT * FROM Customers
WHERE ROWNUM <= 3;