The SELECT statement of MySQL has the following parameter: SQL _CALC_FOUND_ROWS. This parameter can be used with the function FOUND_ROWS () provided by MySQL.
When we use LIMIT ?,? During paging query, only the records you want are returned. For example, if LIMIT 10 is used, the first 10 records are returned. However, we do not know how many records are involved in the entire query, you need to resend a query without LIMIT to obtain the number of records for paging.
The use of the FOUND_ROWS () function does not need to be so troublesome. Try to execute the following SQL statement:
Mysql> SELECT SQL _CALC_FOUND_ROWS * FROM tbl_name-> WHERE id> 100 LIMIT 10;
Mysql> SELECT FOUND_ROWS ();
This method is feasible in the command line mode of MySQL, and it is also feasible to execute it in Navicat, but it is wrong to execute it separately.
In addition, the FOUND_ROWS function can only be executed once after the SQL statement is executed. If it is executed again, 1 is returned.
Finally, this parameter and function are unique to MySQL. If the application needs to support multiple databases, we recommend that you do not use them.