Now it is time to see what is involved in retrieving data from our database.
Comments
How many times have you heard somebody say, if only they had written a comment with this code, we might understand what it is doing. As you start to write SQL scripts, comments will need to be included. This can be achieved by using any of the following methods:
REM This is a comment
? This is a comment
/* This is a comment */
Starting a Transaction
All work against a database is performed within the realms of a transaction. A transaction has a start point, includes a number of SQL statements and upon completion of the transaction, requires you to say whether to COMMIT, that is keep all the changes, or ROLLBACK, undo all the changes, back to the start of the transaction.
Transactions are invaluable in the database world because they give the user the ability to revert changes. For example, imagine a telephone ordering system, where, right in the middle of the order, the customer changes his mind and decides not to place the order. The operator presses the cancel order key, which instructs the database to rollback the changes it has made and return the database to the state it was at prior to the start of this order. Without a transaction, this would be a complex operation.
Whenever you do any work inside the database that changes its contents, the previous contents of the record are...
Copyright Butterworth-Heinemann 1998 under license agreement with Books24x7