SQLite Transaction over two tables

Can I have a single Transaction wrap changes to two tables? That is, I do something like this:

Begin Transaction
delete rows in Table 1
If error then
Rollback
Return
End If
delete rows in Table 2
If error then
Rollback
Return
End If
Commit

Sure can.

I was worried the Rollback would only cover the most recent table.

Nope that’s what transactions are for.

The whole point of a transaction is to allow you to send multiple interrelated commands to the database and roll them all back if just one fails.

For example, imagine you were a bank. To move money from one account (table) to another, you need two sql commands. One to remove the amount from table A and another to add the amount to table B. If either of those commands were to fail, you’d be in big trouble. Without a transaction an error after the first one is easy to fix, but if the second fails, you would have fix whatever went wrong in table B and then go back and reinsert money into table A. Using a transaction, you just issue a Rollback and everything back to the Start Transaction is undone automatically.

More background:

http://developer.xojo.com/userguide/database-transactions

Thanks, all. I have no idea when I started thinking transactions might be restricted to a single table. This thread really helped.