Database Reference
In-Depth Information
EXTEND ... EXTEND (r WHERE C) ADD att r ( 1 ), name 1 AS e 1 ...
ADD att r (n), name n AS e n [
S
]
,
such that for each 1
m
n ,if m/
∈{
i 1 ,...,i k }
then e m =
nr r (m) , and S
=
.
Consequently, all update operators of the relational algebra can be obtained by ad-
dition of these 'EXTEND _ ADD a,name AS e ' operations.
name 1 ,...,name n
Definition 31 We denote the algebra of the set of operations, introduced previ-
ously in this section (points from 1 to 6 and EXTEND _ ADD a,name AS e ) with
additional nullary operator (empty-relation constant)
,by Σ RE . Its subalgebra
without _ MINUS _ operator is denoted by Σ R , and without
and unary operators
EXTEND _ ADD a,name AS e is denoted by Σ R (it is the “select-project-join-
rename+union” (SPJRU) subalgebra). We define the set of terms
T P X with vari-
T P X of Σ R -algebra),
ables in X of this Σ R -algebra (and analogously for the terms
inductively as follows:
1. Each relational symbol (a variable) r
X
⊆ R
and a constant (i.e., a nullary
T P X ;
2. Given any term t R T P X and an unary operation o i
operation) is a term in
Σ R , o i (t R )
T P X ;
3. Given any two terms t R ,t R T P X and a binary operation o i
Σ R , o i (t R ,t R )
T P X .
We define the evaluation of terms in
T P X ,for X
=R
, by extending the assignment
(i.e., R-algebra)
Υ which assigns a relation to each relational symbol (a
variable) to all terms by the function
_
:R→
), where
Υ is the universal database instance (set of all relations in Definition 26 ). For a
given term t R with relational symbols r 1 ,...,r k ∈R
_
# : T P R→ Υ (with
r # = r
t R # is the relational table
obtained from this expression for the given set of relations
,
r 1
,...,
r k
Υ , with
t R UNION t R # =
t R # if the relations
the constraint that
t R #
t R # and
t R # are union compatible;
otherwise.
.
We say that two terms t R ,t R T P X are equivalent (or equal), denoted by
t R
Each R-algebra α
:
X
Υ is a restriction of an assignment
_
to X
⊆R
t R , if for all assignments
t R # .
t R # =
Let us consider an example for terms of the Σ RE algebra of this Definition 31 :
Example 28
Consider the term t R of the Σ RE -algebra, equal to the algebraic ex-
pression
r 1 [
S 1 ] WHERE C 1 UNION (r 2 WHERE C 2 )
S 2 ] WHERE C 5 [
S 5 ]
[
MINUS EXTEND r 3 [
S 3 ] UNION (r 4 WHERE C 4 )
S 4 ]
[
ADD a,name AS e [
S 6 ] ,
Search WWH ::




Custom Search