SQL LIMIT Keyword
The LIMIT clause is used to restrict the number of records returned by a query. It is supported by MySQL and SQLite, including our TechKubo playground.
Note: SELECT TOP is used in SQL Server, and ROWNUM is used in Oracle for the same purpose.
SQL LIMIT Syntax
SQL
x
1
SELECT column1, column2, ...
2
FROM table_name
3
LIMIT number;
SQL LIMIT First 3 Patients Example
This query selects the first 3 rows from the Patients table.
SQL
1
1
SELECT *
2
FROM Patients
3
LIMIT 3;

SQL LIMIT First 5 Appointments Example
This query selects the first 5 rows from the Appointments table.
SQL
1
1
SELECT *
2
FROM Appointments
3
LIMIT 5;
