Introduction to NonStop SQL/MP

Summary
How to Use NonStop SQL
113425 Tandem Computers Incorporated 2–9
Transaction Management When you modify data, you must also ensure that the database does not contain
corrupted data. If, for example, a communication line fails after a user has requested a
cash withdrawal but before the ATM has dispensed the cash, you do not want a
database system to record the withdrawal in the row containing that user's checking
account balance.
To ensure that the database remains consistent when you modify data, you can make
each SQL query part of a transaction. A transaction is a logical unit of work that
changes the database from one consistent state to another.
If a transaction does not finish successfully, the NonStop TM/MP subsystem makes
sure that the database returns to the state it was in before the transaction began. In the
ATM example, if the ATM does not return a message to the application (and to
NonStop SQL/MP) that it has successfully dispensed the money, NonStop TM/MP
rolls back the transaction, and NonStop SQL/MP keeps the original value in the
checking account balance.
NonStop TM/MP manages transactions and protects database changes when the
application is executing. You implement transaction management when you write an
SQL query by defining the beginning and end of the transaction in the application
code.
You use the BEGIN WORK statement to indicate the beginning of the transaction. One
or more queries (UPDATE statements) can be included in a transaction. If the updates
finish successfully, you end the transaction with the COMMIT WORK statement. This
statement commits the changes to the database and ends the transaction. If the
updates do not finish successfully, you use the ROLLBACK WORK statement to
return the database to its original state. NonStop SQL/MP automatically rolls back the
work if a failure (such as an application abort) occurs.
Summary NonStop SQL/MP uses the ANSI-standard and ISO-standard SQL language for
querying the database. NonStop SQL/MP presents data in an accessible format,
makes the relations between data elements easy to visualize, and allows any tables
with a column in common to be joined. Views make it easy to retrieve frequently
accessed data and provide a convenient way to give different users access to different
portions of the database. You can also use NonStop SQL/MP queries to update the
database. NonStop SQL/MP automatically ensures that the data remains consistent
and accurate even when hundreds of transactions execute concurrently.