ROW_COUNT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
Returns the number of rows updated, inserted, or deleted by the preceding statement.
EXAMPLES
CREATE TABLE t (a INT PRIMARY KEY, b INT);
SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 0 |
+-------------+
INSERT INTO t VALUES (1,1), (2,2), (3,3);
SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 3 |
+-------------+
REPLACE INTO t VALUES (1, 1);
SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 1 |
+-------------+
UPDATE t SET b=2 WHERE a=1;
SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 1 |
+-------------+
UPDATE t SET b=2 WHERE a=2;
SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 0 |
+-------------+
DELETE FROM t;
SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 3 |
+-------------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.