Search code examples
databaserdbms

Describe transactions and explain the main principles


could anyone help me answer this question:

Describe transactions and explain the main principles.


Solution

  • I think this link might be helpful http://www.tutorialspoint.com/sqlite/sqlite_transactions.htm

    There are many reasons for them. Among other reasons, transactions protect the integrity of your database data by allowing you to decide at the end of a session whether you want to commit the changes or revert back to the state the database was before you started making changes. Cases where you would want to revert back might be cases where an error occurs in your program while.

    For example, if you are building a program for a bank that handles money transfers, you will likely make a query to update the balance in the customer's first account to be what it was minus the transfer amount. However, if you run into an error when attempting to update the second account, it would be nice to just abandon all the changes made and return both tables to their original state.

    I hope the link helps.