Authorization
Authorization
• Transactions
• A transaction consists of a sequence of query and/or update
statements. The SQL standard specifies that a transaction
begins implicitly when an SQL statement is executed. One of
the following SQL statements must end the transaction:
• Commit work commits the current transaction; that is, it makes
the updates performed by the transaction become permanent
in the database. After the transaction is committed, a new
transaction is automatically started.
• Rollback work causes the current transaction to be rolled back;
that is, it undoes all the updates performed by the SQL
statements in the transaction. Thus, the database state is
restored to what it was before the first statement of the
transaction was executed.
• Transaction rollback is useful if some error condition is
detected during execution of a transaction. Commit is
similar, in a sense, to saving changes to a document that
is being edited, while rollback is similar to quitting the
edit session without saving changes. Once a transaction
has executed commit work, its effects can no longer be
undone by rollback work.
• The database system guarantees that in the event of
some failure, such as an error in one of the SQL
statements, a power outage, or a system crash, a
transaction’s effects will be rolled back if it has not yet
executed commit work. In the case of power outage or
other system crash, the rollback occurs when the system
restarts.
• Banking example,University Credit system
Integrity Constraints