PHP Limit Data Selections From MySQL
Limit Data Selections From a MySQL Database
MySQL gives a LIMIT provision that is utilized to indicate the quantity of records to return.
The LIMIT provision makes it simple to code multi page results or pagination with SQL, and is valuable on huge tables. Restoring an expansive number of records can sway on performance.
Assume we wish to choose all records from 1 - 30 (comprehensive) from a table called "Requests". The SQL question would then look like this:
When the SQL question above is run, it will restore the initial 30 records.
What on the off chance that we need to choose records 16 - 25 (inclusive)?
Mysql additionally gives an approach to deal with this: by utilizing OFFSET.
The SQL inquiry underneath says "return just 10 records, begin on record 16 (OFFSET 15)":
You could likewise utilize a shorter language structure to accomplish the equivalent result: