SQL Select Limit Statement

Select Limit statement is used to retrieve the limit records from the table.

Syntax:-


SELECT * FROM table_name LIMIT limit_number

Note:- limit_number is a numeric value.

Example:-
We have an employees table which has 5 records.


+----+------------+-----------+----------------+------------+
| id | first_name | last_name | email          | address    |
+----+------------+-----------+----------------+------------+
|  1 | John       | Tailor    | john@abc.com   | California |
|  2 | Rom        | Tailor    | rom@abc.com    | California |
|  3 | Andrew     | Symonds   | andrew@abc.com | Sydney     |
|  4 | Miacle     | clerk     | miacle@abc.com | sydney     |
|  5 | Sachin     | Tendulkar | sachin@abc.com | Mumbai     |

Now, we want to get two records from employees table


SELECT * FROM employees LIMIT 2

Output:-


| id | first_name | last_name | email        | address    |
+----+------------+-----------+--------------+------------+
|  1 | John       | Tailor    | john@abc.com | California |
|  2 | Rom        | Tailor    | rom@abc.com  | California |
+----+------------+-----------+--------------+------------+