Returns the number of rows affected by the most recent INSERT, UPDATE, or DELETE statement.
BIGINTDiperbarui: 13 Jun 2026ROW_COUNT()Fungsi ini tidak memerlukan parameter.
1 UPDATE users SET status = 'active' WHERE created_at > '2024-01-01'; 2 SELECT ROW_COUNT() AS updated_rows;
Number of rows that were updated.
1 DELETE FROM logs WHERE created_at < '2024-01-01'; 2 SELECT ROW_COUNT() AS deleted_rows;
Number of rows that were deleted.
1 UPDATE products SET price = price * 1.1 WHERE category = 'electronics'; 2 SELECT CASE 3 WHEN ROW_COUNT() = 0 THEN 'No products updated' 4 ELSE CONCAT(ROW_COUNT(), ' products updated') 5 END AS result;
Check whether any rows were affected by the update.
Sudah paham ROW_COUNT? Latih langsung di browser
Latihan interaktif, langsung di browser.