The LIMIT clause in MySQL helps to get multi pages results or pagination through SQL Databases. This LIMIT clause is very useful on large tables its because returning the large numbers of records through MYSQL will be difficult to read and analyze..
If we wish to get all the records from Database from numbered 1 - 50 from a table called "abcd". The query will be used for this will be-->
$sql = "SELECT * FROM abcd LIMIT 50";
When you run this query written above , you will get the results from 1 to 50 records.
We can use the another query to get the number of results after the selected number of records.The SQL query will get the results "return only 10 records, start on record 50 (OFFSET 50)":
$sql = "SELECT * FROM Orders LIMIT 10 OFFSET 50";
0 Comment(s)