Welcome to FindNerd, today we are going to discuss what is process to use Limit clause in MySQL Query.?
Basically the LIMIT clause is used to specify the number of records to return.
In the MySQL LIMIT clause is used to limit the number of records returned from MySQL query by using value passed with LIMIT clause. This clause is always used with SELECT statement and it takes one or two numeric arguments.This clause is very useful on large tables.
Note:Limit clause takes the value for arguments are only positive integers.
You can see syntax of Limit clause below:
SELECT column_names
FROM table
LIMIT number,
In above syntax there is a LIMIT number for showing record that how much limit number you will pass.
You can see below example:
$query = "SELECT * FROM empl LIMIT 10";
So, when you will execute the above SQL query,it will return the first 10 records.
Another example of LIMIT clause:
$query = "SELECT * FROM empl LIMIT 10 OFFSET 20";
So, when you will execute the above SQL query,it will return the first 10 records start on record 21 (OFFSET 20)".Because offset of first row to return.(default value is 0).
0 Comment(s)