SQLite: How many rows were affected by an UPDATE or DELETE?
Info by SmartUser | 2013-11-08 at 00:37
Question: We have performed an UPDATE or a DELETE request in our SQLite database. Now we are interested in how many rows from our table have been infected by this. For example, to check whether there were made any changes at all.
Solution: The function changes() helps us in this case. It gives us the number of rows that were affected by the last INSERT, DELETE or UPDATE statement. A call might look like this:
SELECT changes() FROM tab
If you have performed an INSERT, DELETE or UPDATE on the table "tab" before calling this command, the expression gives us the number of rows affected.
If we are interested in the total number of affected rows since connecting to the database, we can use the function total_changes() instead of changes() for this.
About the Author
The author has not added a profile short description yet.
Show Profile
Related Topics
MySQL: Delete Data from Table - Difference between TRUNCATE, DELETE and DROP
Tutorial | 0 Comments
MySQL: How many records have been found or are affected by my query?
Info | 0 Comments
SQLite: Check whether Table exists
Info | 0 Comments
CSS: Colorize Table Rows Alternately only with CSS
Tutorial | 0 Comments
MySQL: Rename Name of a Database
Tip | 1 Comment
Windows Batch Script: Computer Shutdown
Tutorial | 2 Comments
PHP: Colorize Table Rows Alternately with PHP
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.