1024programmer Mysql How does mysql return the total number of queries

How does mysql return the total number of queries

Mysql returns the total number of queries: first open the terminal; then add modification [SQL_CALC_FOUND_ROWS] to the SELECT statement; finally execute [select SQL_CALC_FOUND_ROWS], and then take the total number of records.

Enter statement:

select * from auth_user
 SELECT FOUND_ROWS() //Returns the total number of query records
 select sql_calc_found_rows col_name from table_name limit 5,3;
 select found_rows()

Add modification SQL_CALC_FOUND_ROWS

After adding SQL_CALC_FOUND_ROWS to the SELECT statement, even if you use limit n,m, SELECT FOUND_ROWS() will still return the total number of records satisfying the condition. In this way, after you execute select SQL_CALC_FOUND_ROWS, just fetch the total number of records.

More related free learning recommendations: mysql tutorial (video)

The above is the detailed content of how mysql returns the total number of queries. For more information, please pay attention to 1024programmer. com Other related articles!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-does-mysql-return-the-total-number-of-queries/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索