Information Technology Reference
In-Depth Information
2. Inserting a new tuple t into relation r . Such an insert action is generated by the
SQL statement insert into r values .t /.
3. Deleting a tuple t from relation r .The SQL statement delete from r where C
generates a sequence of such delete actions, one for each tuple satisfying the
selection condition C .
4. Updating the value of an attribute A of a tuple t in relation r .The SQL statement
update r set A D e where C generates a sequence of such update actions (if e
is a constant) or a sequence of pairs of a read action followed by an update action
(if e contains attributes whose values thus are read in computing the value of e),
one for each tuple satisfying condition C .
5. Creating a new relation r.Z/ in the database. The input to the action is a relation
schema, and the action is possible when there is no relation named r already in
the database. The action creates a new, empty relation on which other actions
can subsequently be performed. This action is generated by the SQL statement
create table r.Z/,whereZ is the SQL definition of the attributes and integrity
constraints of the schema.
6. Deleting an empty relation r from the database. After this action, the only action
that can be applied to r is action (5). The SQL statement drop table r generates
a sequence of tuple-deletion actions (3), one for each tuple in r ,followedbythe
deletion of r .
Logical database actions also include certain transaction-control actions needed
for managing transactions: beginning a new transaction, committing a transaction,
aborting a transaction (i.e., starting rollback), and completing a rollback. The exact
set of logical actions used in this topic is fixed later, when the transaction model (the
key-range model) is defined.
1.3
Integrity of the Logical Database
As is customary with treatments of relational database management, we may use
the terms “database” and “relation” with two meanings: on the one hand, a logical
database (resp. a relation) may mean a database value (resp. relation value ), that
is, some fixed contents of the database (resp. relation) as a bag of tuples, and on
the other hand, it may mean a database variable (resp. relation variable ), that is,
a variable that can take a database (resp. relation) as its value. The context should
make it clear which of the two meanings is assumed. Sometimes, when we wish to
emphasize the distinction between the two meanings, we may talk about database
states when referring to database values.
For each logical database and for each of its relations, considered with the latter
meaning (as a variable), there is a set of associated integrity constraints ,which
have been specified at the time of creating the database or relation (with the SQL
create table statement) or added afterwards (with the SQL alter table statement).
An integrity constraint may be internal to a single relation such as a key constraint
Search WWH ::




Custom Search