In MySQL, the LIMIT Clause is used to return the specified number of records means by using LIMIT we can specify how many records we want to return from a table..
The LIMIT Clause is useful when, we want to select some records from a table which has thousands of records.
LIMIT Clause Syntax
SELECT column_name(s)
FROM table_name
LIMIT number;
We have a table "employee" as below:
employee
id first_name salary country
.......................................................
1 John 10000 Canada
2 Chris 20000 California
3 Max 30000 London
4 Jenny 25000 Canada
LIMIT Clause Example
The below statement returns the 2 records of the employee table:
SELECT *
FROM employee
LIMIT 2;
Result
id first_name salary country
.......................................................
1 John 10000 Canada
2 Chris 20000 California
Hope this will help you :)
0 Comment(s)