Syntax\n------\n\nFOUND_ROWS()\n\nDescription\n-----------\n\nA SELECT statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many rows the statement would have returned without the LIMIT, but without running the statement again. To obtain this row count, include an SQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke FOUND_ROWS() afterwards.\n\nYou can also use FOUND_ROWS() to obtain the number of rows returned by a SELECT which does not contain a LIMIT clause. In this case you don't need to use the SQL_CALC_FOUND_ROWS option. This can be useful for example in a stored procedure.\n\nAlso, this function works with some other statements which return a result set, including SHOW, DESC and HELP. For DELETE ... RETURNING you should use ROW_COUNT(). It also works as a prepared statement, or after executing a prepared statement.\n\nStatements which don't return any results don't affect FOUND_ROWS() - the previous value will still be returned.\n\nWarning: When used after a CALL statement, this function returns the number of rows selected by the last query in the procedure, not by the whole procedure.\n\nStatements using the FOUND_ROWS() function are not safe for statement-based replication.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n************************ 1. row *********************\n      Engine: CSV\n     Support: YES\n     Comment: Stores tables as CSV files\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n********************* 2. row *********************\n      Engine: MRG_MyISAM\n     Support: YES\n     Comment: Collection of identical MyISAM tables\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n\n...\n\n********************* 8. row ************************\n      Engine: PERFORMANCE_SCHEMA\n     Support: YES\n     Comment: Performance Schema\nTransactions: NO\n          XA: NO\n  Savepoints: NO\n8 rows in set (0.000 sec)\n\nSELECT FOUND_ROWS();\n+--------------+\n| FOUND_ROWS() |\n+--------------+\n|           8 |\n+--------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/found_rows