SQL LIMIT

We can use this to specify the numbers of record sets to return

SQL LIMIT Syntax

SELECT * FROM table_name LIMIT some_value(should be a number)

MySQL Table – users

+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | JS   |
|  3 | HTML |
|  5 | ASP  |
+—-+——+

Example

mysql> select * from users  LIMIT 2;
+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | JS   |
+—-+——+
2 rows in set (0.00 sec)

Share