This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-21. For the latest, interactive version please visit https://mariadb.com/kb/.

ROW_COUNT

Sintassi

ROW_COUNT()

Spiegazione

ROW_COUNT() restituisce il numero di righe inserite, modificate o eliminate dall'ultima istruzione. E' lo stesso numero visualizzato dal client mysql e restituito dalla funzione dell'API C mysql_affected_rows().

Esempi

MariaDB [test]> create table t (A INT);
Query OK, 0 rows affected (0.08 sec)

MariaDB [test]> INSERT INTO t VALUES(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

MariaDB [test]> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
|           3 |
+-------------+
1 row in set (0.00 sec)

MariaDB [test]> DELETE FROM t WHERE A IN(1,2);
Query OK, 2 rows affected (0.01 sec)

MariaDB [test]> SELECT ROW_COUNT(); 
+-------------+
| ROW_COUNT() |
+-------------+
|           2 |
+-------------+
1 row in set (0.00 sec)

MariaDB [test]> 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.