Information Technology Reference
In-Depth Information
( primary key , unique ) or it may span over two relations such as a referential
integrity constraint ( foreign key ).
Integrity constraints restrict the values that the database and relation variables are
allowed to take. A logical database (i.e., its state) is integral or consistent if it fulfills
the integrity constraints specified for the database.
An attempt to perform an update action that violates an integrity constraint
specified by SQL on the database either returns with an error indication, or triggers
a sequence of corrective actions so as to make the violated constraint to hold
again if such corrective actions have been specified. In addition to constraints
that can be specified by SQL create table and alter table statements, the logical
database usually satisfies some application-specific constraints. Applications using
the database must check for these and keep them satisfied.
As a running example of a relation, we use
r.X;V/;
where X and V are sequences of attributes. The underlining of X means that we
have specified a key constraint on the relation: a relation that satisfies this constraint
cannot contain two distinct tuples t and u with tŒX D u ŒX . The attribute sequence
X is called the primary key ,or key for short, of the relation.
1.4
Transactions
When a database application process is running, it generates a sequence of requests
to perform SQL queries and update operations on the database stored at the
server. The server-process thread allocated to service the application process parses,
optimizes, and executes the queries and update statements in the order in which they
arrive from the application. From the view of the logical database, the execution of
a query or an update statement is a sequence of tuple-wise actions on the relations
in the database.
The sequence of SQL requests coming from the application process is divided
into subsequences by issuing occasionally an SQL commit or rollback request. The
sequence of tuple-wise actions on the logical database resulting from one such
subsequence of requests, that is, one that extends from the action immediately
following a commit/rollback request (or from the first action of the application)
to the next commit/rollback request, is called a transaction.
A transaction is an action sequence that the database application programmer
wants to see as forming an atomic (i.e., indivisible) unit of work: either (1) all
changes to the logical database produced by the transaction are done or (2) none
of the changes appear in the logical database. Requirement (1) must hold in the case
of a committed transaction , obtained by terminating the transaction with a commit
request, while requirement (2) must hold in the case of an aborted transaction ,
obtained by terminating the transaction with a rollback request. Requirement (2)
Search WWH ::




Custom Search