ROW_COUNT() returns the number of rows updated, inserted, or deleted by the preceding statement. : ROW_COUNT : Information Functions MySQL TUTORIALS


MySQL TUTORIALS » Information Functions » ROW_COUNT »

 

ROW_COUNT() returns the number of rows updated, inserted, or deleted by the preceding statement.


mysql>
mysql>
mysql> CREATE TABLE t (id INT NOT NULL);
Query OK, rows affected (0.01 sec)

mysql>
mysql> INSERT INTO t VALUES(1),
    ->                     (2),
    ->                     (3);
Query OK, rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql>
mysql> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
|           |
+-------------+
row in set (0.00 sec)

mysql>
mysql> DELETE FROM WHERE id IN(1,2);
Query OK, rows affected (0.00 sec)

mysql>
mysql> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
|           |
+-------------+
row in set (0.02 sec)

mysql>
mysql> drop table t;
Query OK, rows affected (0.00 sec)

mysql>
mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Information Functions
» ROW_COUNT