Datasheet

Second, stored procedures are similar to procedures and functions in other programming languages, as
they can contain input and output parameters and can return values. They use logic to control the flow
of processing, and numerous functions and SQL statements can be used in stored procedures.
You can use stored procedures to execute routine functions, such as selecting, inserting, updating, and
deleting data. A single stored procedure can be executed by multiple applications, thus providing code
reuse. You learn more about stored procedures in Chapter 9.
Views
A view is like a virtual table containing data from one or more tables. A view is stored in the database as
the actual SQL statements that are contained in the view, such as a stored procedure. When the view is
referenced, the virtual table is created using the SQL statements that are contained in the view.
Views are generally used to enable users to see data from multiple tables in one view, thereby giving the
illusion that the data exists as one table or group of data. This provides a couple of benefits. First, by
providing the impression that all of the data is in one table, the complexities of the database are hidden
from the user. Second, it provides a security mechanism in that you can grant a user access to the view
but not to the actual tables from which the view is derived, and you can limit the data a user sees.
Because a view is like a virtual table, you can execute SQL
SELECT statements against a view, thereby
selecting only the data from the view that you need to see. You can also limit the results by using a SQL
Where clause and order the results using a SQL Order By clause. You learn more about these basic
SQL clauses starting in Chapter 4 and more about views in Chapter 9.
Log files
Each database that you create has its own transaction log. The transaction log contains transactions that
have been applied against your database. A transaction is the execution of a group of SQL statements as
one logical unit of work. SQL Server automatically manages transactions in the transaction log, generating
a before-and-after picture of the data in a table that is changed. This means that you can execute an
update query to update a row of data and SQL Server logs a record of the data before it was changed and
after it was changed. This allows for backward and forward recovery of the data in your database.
SQL Server manages transaction logging automatically. You can, however, use transactions in your
stored procedures to perform automatic recovery of the data that your stored procedures changed. You
can also use transactions in the
ADO.NET classes that provide data access to your database. Transactions
are covered in more depth in Chapter 11.
Oracle Databases
Just as SQL Server databases are more complex than Access databases, Oracle databases are more complex
than SQL Server databases. Because Oracle was designed to be platform independent, its architecture is
more complex, and a single database in Oracle consists of more files than a SQL Server database.
Oracle comes in multiple editions: Enterprise, Standard, and Personal. However, the database engine
components are virtually the same for all editions. Each edition supports features not found in the
previous edition. For example, the Standard edition supports multiple processors, whereas the Personal
edition does not. Likewise, the Enterprise edition supports transparent application failover support, but
the Standard edition does not.
7
Databases
04_58894x ch01.qxd 10/13/05 5:54 PM Page 7