Google News
logo
MariaDB - Interview Questions
How do we get the number of rows affected by any query ?
Before executing any update/delete on the table data, it’s always best practice to check the number of rows that are going to be affected i.e.,  updated / removed from table with COUNT() operation with the given WHERE condition to cross check whether we’re doing correct update or not
SELECT COUNT(user_id) FROM users WHERE <>;  
will only return the number of user_id s going to effect.
Advertisement