RELATIONAL
COMPLETENESS
OF DATA BASE SUBLANGUAGES
E. F. Codd
IBM Research
Laboratory
San Jose,
California
ABSTRACT:
In the near future,
we can expect
a great
variety
of languages
to be proposed
for interrogating
and updating
data bases.
This paper
attempts
to provide
a theoretical
basis which may be used to determine
how
complete
a selection
capability
is provided
in a proposed
data sublanguage
independently
of any host language
in which the sublanguage
may be embedded.
A relational
algebra
and a relational
calculus
are defined.
Then, an
algorithm
is presented
for reducing
an arbitrary
relation-defining
expression
(based on the calculus)
into
a semantically
equivalent
expression
of the
relational
algebra.
Finally,
oriented
optimal
some opinions
are stated
regarding
the relative
merits
of calculusversus
algebra-oriented
data sublanguages
from the standpoint
of
search
and highly
discriminating
authorization
schemes.
RJ 987 Hl7041)
March
6, 1972
Computer
Sciences
1
1.
INTRODUCTION
In
the
near
proposed
for
oriented
components
storage
we can
interrogating
and
and
of
retrieval
sublanguage
it
future
such
(even
though
data
a language
are
in
in
which
it
may contain
bases.
purpose
case,
it
is
of
we refer
the
remaining
A data
language,
called
simple
be
computationto
programming
for
to
sublanguaqe.
commonly
provision
languages
When the
as a data
a general
--
variety
removed,
sublanguage
may be embedded
language
a great
updating
oriented
may be stand-alone
expect
or
a query
updating
as well
as querying).
This
used
paper
to determine
proposed
data
sublanguage
a basic
of
a selection
one.
invoking
of
The
selection
In
a practical
and
summing
any one of
basis
capability
is
any host
language
capability
of
it
which
would
with
library
a
the
discussion
together
set
in
in
under
capability,
may be
provided
environment
a finite
which
is
need
to
the
functions
tailored
environment.
previous
any
of
assorted
of
relational
algebra.
that
of
this
paper
oriented
data
degrees.
In
is
names
its
sublanguages.
algebra
could
be used
a relational
viewed
Section
on relations
language
support
we proposed
base
This
domain
Cl 4
data
operations
a query
propose
papers
formatted
collection
example,
a theoretical
independently
by a counting
model
relations
how complete
non-statistical
In
this
establish
may be embedded.
capability
that
to
sublanguage
be augmented
to
attempts
2 of
may be used
be directly
use as a yardstick
For each
such
of
as a collection
, and this
instead
model
this
paper,
for
domain
of
is
a variety
on it
language,
time-varying
called
of
power
one would
a
a
purposes.
(however,
numbers).
selective
With
we define
collection
based
of
of
data.
For
we would
Later
of
sections
algebra-
investigate
,whether
there
defined
in
is
the
any operation
candidate
Section
and
reasonable
queries.
[6,7,81
Kuhns.
A data
calculus,
used
introduce
a number
These
of
algebra
different
which
cannot
orientation
his
(called
informally
of
comparing
are
relational
sublanguage
been
predicate
concepts
concepts
model.
as a means
a rather
an applied
relational
has
relational
be
was
t-51
However,
author's
with
3, we define
calculus-----
this
algebra
by R. Bosak.
In
the
language.
An information
proposed
of
calculus--the
related
somewhat
data
ALPHA),
file
founded
described
in
calculus-oriented
to meaningful
to
is
structured
than
on the
relational
less
This
data
those
and
related
directly
[4].
relational
of
J.
calculus
can also
sublanguages
with
L.
be
one
another.
In
alpha
the
Section
4,
expression
into
relational
algebra
has
at
comparing
called
the
LA
with
with
the
as indicated
MACAIMS
is
the
Fig.
work
of
of
given
1.
translating
the
and
In
figure,
as an example
of
operations
the
relational
with
the
the
Project
an algebra-oriented
As a
algebra-oriented
language
LC
in
relational
calculus.
any given
calculus-oriented
algebra
of
that
comparing
this
an arbitrary
sequence
demonstrates
power
relational
in
cited
algorithm
any
for
equivalent
selective
we may shortcut
LA
calculus,
This
least
sublanguage
an algorithm
a semantically
algebra.
consequence,
data
we provide
LC
by
relational
MAC system
language
bee Dl>.
In
founded
section
5,
we consider
on a relational
algebra
the
pros
versus
and cons
those
of
founded
data
sublanguages
on a relational
calculus.
CALCULUS-ORIENTED LANGUAGES
Fig.
1:
COMPARISON %-lEME FOR DATA %J?alANGUAm
4
2.
A RELATIONAL
2.1
Objective
The
primary
operations
for
ALGEBRA
purpose
on relations
selecting
operated
upon
they
defined
are
discuss
the
&Data
algebra)
of
data
from
are
assumed
are
is
of
form
are
operations
have
no effect
notational
that
identified
as the
first,
many
practical
in
that
names
when
actually
2.2
than
storing
Introductory
Our
compound)
the
rather
the
formation
relations
is,
the
In
(by
the
third,
data
bases
and
the
numbers
4,
we shall
of
collection
by values
relation
of
we deal
a given
into
retrieved
with
be used
of
to
latter
data.
domain-ordered
relation
are
un-
These
As pointed
relations
the
of
a relation
so on.
would
on which
and Appendix).
convenience,
of
be
some operation
content
domains
to
Section
existing
[4]
information
suitable
domains
a normalized
(see
of
operations.
as ordering
elsewhere
retrieving
binary)
The
of
and factoring
second,
a collection
such
can
be
out
in
high
identify
[l],
degree
domains
information.
Definitions
aim
in
and
the
operations
that
such
individual
or
base.
from
expository
provide
necessarily
collection
relation
position
to
and below).
as the
on the
and
is,
[2,3]
this
viewed
discussed
relations;
however,
of
domains
normalized
For
(not
be normalized;
operations
its
is
data
(see
a new normalized
or more
degrees
to
power
Presentation
in one
algebra
a relational
selective
relations.
this
all
simple
selection
of
of
to
this
kinds
section
of
is
relations
be subsequently
to
define
the
(normalized)
defined.
kinds
of
which
domains
are
(simple
operands
and
for
5
The Cartesian
defined
product
of
two sets
is
denoted
C x D, and
is
by:
C x D = {(c,d):
The
defined
expanded
Cartesian
c E C A d E D}.
product
x
of
n
sets
D,,
D2,
. . . . Dn
dj
E Dj
for
j
= 1,
tuples
for
is
by:
x(D,,D2,...,D,)
The
C, D
elements
n = 1,
of
~$1
= C(dl,d2,...,dn):
such
a set
are
since
= D,
called
n-tuples,
no distinction
or just
is made
between
2,
. . . , nl.
short.
a l-tuple
and
. . . . en).
The
When
its
only
component.
Suppose
d = (d,,
concatenation
of
d
with
dne=
R
x(+
is
D2,
members
relation.
ternary,
its
a relation
all
underlying
consisting
may be included
of
the
n-tuples
of
degree
The
definitions
integers
(m + n)-tuple
D,,
below).
D2,
is
accordingly
n
is
1 are
sets
on which
base
if
a..,
desired,
defined
if
Dn
by
it
a special
unary,
the
degree
a relation
with
types
only
a subset
of
of
Its
set.
degree
of
2 binary,
is
we are
(other
is
kind
called
purposes,
strings
e2,
enI.
a constant
called
and character
definition
e = (e,,
dm,e,,e2 ,...,
For data
this
and
the
sets
where
n n-ary.
in
is
(d,,d2 ,...,
domains.
of
e
A relation
Relations
degree
. . . . dm)
on the
. . . . D,,).
are
d2,
the
degree
defined
are
called
concerned
with
data
of
minor
primitive
changes
3
elements
in
some
A simple
all
domain
of
whose
domains
alone
is
the
term
whenever
simple
elements
normal
k,
a set
are
said
to
all
of
character
is
whose
elements
strings.
be simple
relation
used
are
integers,
A relation
normal.
In
the
without
further
or a set
defined
remainder
of
on simple
this
qualification,
paper,
it
means
relation.
A compound
(say
is
domain
k 2 1) of
is
simple
the
expanded
domains;
k
Cartesian
is
product
called
the
degree
of
a finite
of
the
number
compound
domain.
Two simple
or both
are
domains
domains
union-compatible
of
if
(j=l,Z,...,m)
the
the
simple
jth
compound
The
product
a relation
of
which
the
Operations
to
be defined
R
2,
(degree
using
the
employed
in
the
Operations
m)
with
definition
the
R @ S, whose
domain
and
of
D
R,
are
S
in
are
are
m + n.
are
every
j
with
if
union-compatible.
the
intersection,
join,
product
n)
above.
however,
yields
product
difference)
division,
first.
2.2
This
D, E
two classes:
Cartesian
(degree
integers
union-compatible
operations
Section
algebra,
is
S
(projection,
- The usual
for
of
union-compatible
union,
set
relation
domains
into
product,
traditional
given
is
naturally
domains
m) and
subsets
on relations
relational
degree
S
fall
(Cartesian
are
(say
Two relations
R
both
Two compound
same degree
simple
operations
Set
the
E.
We consider
relation
of
of
if
strings.
.th
operations
Traditional
degree
J
traditional
restriction).
2.3.1
the
of
set
less
are
operations
traditional
and
they
domains
union-compatible
character
domain
Definitions
2.3
are
is
R x S
a relation
The
of
Cartesian
an expanded
is
of
defined
by
product,
,
R a S = {(rns):
usual
Union
(u),
way,
except
normal
2.3.2
intersection
that
(n),
they
are
Projection
2,
- Suppose
... . m
For other
values
A = (j,,
applicable
of
notation
j,
. . . . m)
When the
list
a list
Then,
of
A
of
the
is
is
that
is
a relation
in
order
pairs
In
the
the
(not
m-ary
defined
of
in
the
union-compatible
necessarily
relation
.th
J
the
We extend
undefined.
of
when
r&l,
r[A]
(not
whose
of
of
designates
integers
empty,
integers
projection
Note
existential
to
are
R.
For
component
the
of
notation
distinct)
to
from
r.
a list
the
set
as follows
RCA]
use of
only
a tuple
r[j]
r[j]
. . . , jk)
j,,
2,
the
is
r
rl31 = bCj,l,
A
(-)
difference
relations.
j = 1,
(1,
r E R A s E Sl.
.. . ,
Let
= r.
necessarily
R
on
= {r[A]:
A
is
domains
A
R
be a relation
distinct)
is
defined
from
the
of
set
degree
(1,
2,
m, and
. . . . m}.
by
r E R}.
a permutation
are
r[jk]).
the
of
the
list
same as those
of
(1,
R
2,
except
. . . , m-1, R[Al
for
a change
appearance.
Fig.
2, we exhibit
fact
that
quantifier.
projection
some examples
provides
of
projection.
an algebraic
Later
counterpart
we shall
to
the
make
.
R(D,
D2
D3)
.
a
2
f
b
1
9
C
3
f
d
3
g
e
2
f
R[zl(D, >
RI1I@, >
R[31(D, >
f
9
R[Wl(D,
R[3;2,21@,
D2)
O3)
f
2
f
2
2
9
1
9
1
1
f
3
f
3
3
9
3
9
3
3
Figure
A ternary
D2
relation
R
and five
2
of
its
many
projections.
9
2.3.3
Join
- Let
o-join
of
relation
defined
8
R
any of
on domain
the
A
relations
with
=,
relation
f,
<,
S
5,
>, and
on domain
B
2.
providing
every
that
is
8 B]S
element
r c R A s E S A (r[A]
= {(r?):
of
x
is
B-comparable
Fig.
3,
we exhibit
RCA]
is
with
e-comparable
y
if
0 s[bl)L
with
xey
is
every
either
element
true
or
of
S[B].
false
(not
undefined).
In
R(A
The
by
R[A
Note
denote
B
some examples
of
joins.
C)
a
11
a
2
b
12
c
2
5
c
3
3
S(D
1
R[C = C]S(A
B
bl
c
3
R[B
E)
2
u
3
v
4
u
C
D
E)
2
2
u
a
212
3
3
v
c
2
5
2
u
c
3
3
3
v
R[C > D]S(A
B
C
D
E)
c
3
3
2
u
c
2
5
2
u
c
2
5
3
v
c
2
5
4
u
Figure
Relations
= D]S(A
R,S
3
and
three
joins
B
C
D
E)
u
10
Note
that
R[C < D]S
The most
equi-join.
In
relation
are
in
commonly
needed
join
the
of
equi-join,
case
identical
by projection,
u R[C = D]S
in
is
is
the
Division
under
T
join
one
of
the
the
join
=, which
on
two of
natural
- Suppose
is
defined
T
is
a binary
of
domains
redundant
the
we call
of
the
the
resulting
domains
given
is
relations
removed
as defined
Consider
of
for
the
question
degree
R, and
to
A
and
and
let
in
?i
S
that
on
denote
with
the
the
R[A]
B
of
domain-identifying
For
(possibly
is
a subset
and
is
defined
R[A
t B]S
example,
if
image
We treat
the
compound)
S[B]
degree
(without
list
that
degree
dividend
domains
K,
of
set
of
x
of
RCA].
are
union-compatible,
r E R A S[B]
A
c_ g,(r[K])}.
the
by a relation
repetitions)
is
complementary
m
of
R
the,image
by
= Ir[m:
m
list
the
r E R, we can speak
any tuple
this
R
be a domain-identifying
A = (1,3,4).
Providing
by
A
then
given
and we note
The
E J-1.
a relation
order.
relation
Accordingl.y,
dividing
ascending
A = (2,5),
binary
of
Let
n.
relation.
by
gT(‘) = {y: b,y>
A
> D]S = R QD S.
[2].
2.3.4
S
the
If
content.
resu It
the
the
u R[C
in
as if
R
were
it
were
that
order.
set
g,(r[K]),
division
5
of
R
a
on
.
11
Note
that,
when
also
empty.
In
Fig.
that
projection
from
division
R
is
R
empty,
4, we exhibit
on the
P
1
11
2
3
4
by
two examples
of
dividend
followed
R(A
divided
preceding
by projection
operations
2.3.5
1
'11
y
X
2
11
12
z
x
Y
1
see that
R.
introduced:
Figure
4
of
R
The e-restriction
division
= R[a
- Suppose
R
8
of
denote
R
This
observation
is
show
a different
effect
S
provides
an algebraic
counterpart
division
is
in
definable
@ S[D])-
R)[a.
and
A, B
are
=,
<,
a relation
on domains
klas made
by
-((R[a
any of
R[A 8 B] = {r:
t
examples
is
terms
to
of
the
t
R[C + D]S
Let
S
t D]S = (111.
Actually,
quantifier.
if
quotient.
X
already
for
on the
can have
x
Restriction
lists
division
even
These
0
we shall
universal
empty,
S(D
Division
the
is
division.
C)
R[B,C][C
Later
S
the
relations
A, B
is
r E R A (r[A]
by Paul
Healey
of
defined
f,
domain-identifying
s,
>,
and
by
8 r[B])>,
IBY Research,
San
Jose.
2.
12
providing
every
element
of
R[A]
is
&comparable
with
every
element
of
R[B].
.
In
Fig.
5, we exhibit
two examples
of
RjA
R[B
B
C)
P
2
1
9
2
3
q
5
4
r
3
3
B
C)
3
3
B
C)
P
2
1
9
5
4
= C](A
r
R[B
> C](A
Figure
A relation
This
It
is
operation
definable
R
is
in
terms
and
the
R[A 0 B] = (R&
where
L
and
A%
with
S
is
a list
denotes
is
likewise
identifying
the
its
restrictions.
because
B-join
of
its
already
all
the
of
in
terms
direct
of
R
A
with
list
of
R[A 8 B]S = (R 8 S)[A
in
Section
4.
Thus,
8 B]R[B]))[L],
domains
list
use
introduced.
=A??](R[A][A
concatenation
definable
5
two of
introduced
of
restriction.
Cartesian
8 B].
in
product
ascending
B.
order,
The e-join
and e-restriction:
of
R
13
2.4
Sample
Queries
Suppose
a data
includes
the
Domain
S
suppliers
supplier
f
supplier
T
SUPPlY
supplier
#
part
expressions
E
Find
the
Item
j
lists
for
Domain
two relations:
Relation
1 below
Name
following
Symbol
Table
n
base
nine
1
along
queries,
with
2
name
supplier
numbers
of
the
suppliers
1.
Something
T[ll
2.
Nothing
SC11 - T[ll
3.
Part
appropriate
each
of
algebraic
whom supplies:
4.
Something,
5.
riot
6.
A part
7.
Part
8.
At least
9.
All
(T[2=1]{15}
15
but
not
part
15
T[ll
-0
SD1 -0
15
than
15
- 115 ~>>>rN
(T[Z=l](T[Z]
043
15 only
parts
location
#
Ej
other
3
them.
j
part
Domain
parts
12,
13,
T[Z+l]{lZ,
15
supplied
T[W]T
Table
Examples
13,
of
Algebraic
1
Expressions
15)
1
14
n
the
Find
table
the
locations
of
those
examples
expressed
each
of whom supplies
item
j
in
above
(S[l
These
suppliers
in
demonstrate
terms
of
the
= lIEj)['I.
that
relational
reasonably
algebra.
complicated
queries
can be concisely
15
3.
RELATIONAL
Having
calculus
CALCULUS
defined
which
consisting
may also
of
a finite
Alphabets,
3.1
The
a relational
be used
alphabets
Individual
in
the
collection
Terms,
for
we now consider
algebra,
of
and
Formulae
this
calculus
formulation
relations
listed
a,,
a2,
Index
Constants
1, 2,
Tuple
Variables
r,,
monadic
P,'
d,yadic
=,
Symbols
The Alphabets
relations
the
intended
between
in
the
the
given
of
data
membership
A monadic
predicate
followed
R.
J
as its
base
form.
2 below:
..+
...
r2,
r3,
...
P*,
P3'
**a
>,
Pjr
range.
is
interpreted
I,
2,
#
A, "91
0
9
2
the
Relational
monadic
indicates
term
on any data
normal
Table
3, 4,
<,
Calculus
a one-to-one
interpretation,
Pj
range
in
Cl
Table
established
simple
a3¶
3, v,
Delimiters
Under
queries
predicate
Constants
Logical
Then,
in
are
Constants
Predicate
of
an applied
predicates
(as many
Suppose
base.
of
tuples
by a tuple
as stating
the
in
that
as are
relations
is
tuple
is
needed)
are
Rj
relation
variable
correspondence
(j
called
variable
and
R,,
R2,
= 1,
2,
a range
r
the
. . . . RN'
. . . . N).
term.
The
has relation
16
An indexed
N
is
tuple
an index
tuple
has
Its
constant.
form
r[N]
where
r
purpose
is
to identify
is
a tuple
variable
Nth
the
and
component
of
a
r.
Let
6
be indexed
called
join
range
terms
be one
tuples
of
and
and join
defined
relational
cx
1.
Any term
2.
If
r
3.
If
I-1,
4.
If
r
No other
The
usual
calculus.
an individual
of
formulae
=,
f,
constant.
the
<,
Then,
relational
calculus
5,
>,
and
A@J
are
2.
and
of
Let
XBa
only
two
(abbreviated
WFF) of
the
relational
calculus
as follows:
is
a WFF;
a WFF, so is
are
r2
WFFs,
is
a WFF in
and
Wr(r)
formulae
conventions
use of
symbols
terms.
is
5.
predicate
terms
recursively
3r(r)
duplicate
the
The
terms.
The well-formed
are
the
bound
1I';
so are
which
are
r
occurs
v r2)
and
as a free
(r,
A r2);
variable,
then
WFFs;
are
WFFs.
are
adopted
variables.
(T,
Table
for
saving
3 gives
parentheses
examples
of
and avoiding
WFFs of
the
X,n
are
types:
17
WFFs with
no range
r,Dl
Free
terms
> al
rl
3r, (r, C31 > al 1
none
3q (r, i31 = r&W
Vr,3r2((r,
r2
IiS1 = r$l)
none
A (r&l1 = a$)
(r,C31 = r,CW A 3r3h$11 = al >
WFFs with
Variables
range
terms
'v2
only
‘gr3
‘gr3
A P7r2
‘f3
” ‘sr3
P5r3
A lP6r3
Range-Separable
P8r,
WFFs not
WFFs
* (r, [31 = al >
rl
P7r2 * C-y-, (r, C31 = r2K-4
r2
Range-Separable
b-g,
v (r, C31 = al 1
P7r2
A 3r,Ur,
lP8r,
* (r,C31
rl
v Qf,)
[31 = r21N)
= al 1
rl
Table
Examples
r2
of
WFFs of
the
3
Relational
Calculus
18
Range
3.2
Separability
With
each
The
range.
range
WFF over
more
range
is
r
the
terms,
the
are
specifying
the
range
not
variables
tions
from
which
difference
Let
is
predicates
having
The
and
be a proper
free
r
from
we replace
3r
by
3rr,
quantifiers
and
are
defined
not
variables
at
terms
WFF over
have
r.
by
by the
but
the
clearly
must
A proper
are
that
it
immediately
in
that
two or
with
relation
prohibit
tuple
relations
or
intersection,
defined
into
called
R
relaand
ranges.
no range
r
the
prohibits
stating
given
Suppose
term
Ir(A)
in
or
r.
Vr(A),
range-coupled
equations:
W(A) = 3r(r A a)
VI’(A)
Now, we can define
its
variables.
A WFF is
= Wr(lr
v
a class
of
range-separable
A).
WFFs having
if
it
clearly
is
defined
a conjunction
'
terms.
be associated
containing
These
range
r.
occurs
union,
To introduce
Wrr.
r
together
by applying
must
or
constraint
than
relations.
is
all
by merely
of
are
defined
two constraints:
syntactic
other
variable,
Vr
variable
occur
those
a clearly
terms
whenever
r
them
pairs
and
free
satisfying
in
are
as a free
range
only
two constraints
which
union-compatible
bound
whose
variable
r.
ranges
of
The
a tuple
of
WFF, all
that,
union-compatible.
range
a WFF having
r
range
of
goal.
does
constraint
associate
this
r
1
to
at
WFF over
either
can be generated
to
Both
A
the
aimed
WFF whose
a range
semantic
which
is
are
a range
that
relations
(say)
is
-r
A; and
a WFF, we need
a quantifier-free
constraint
follows
in
definitions
WFF is
--WFF over
syntactic
variable
following
A range
A range
tuple
ranges
for
of
form
the
all
19
u, A u* A . . . A un A v,
where
1)
nzl;
2)
u,
through
are
Un
proper
range
WFFs over
n
distinct
is
simply
tuple
variables;
3)
V
is
u, *
either
u2"
null
(in
every
quantifier
b)
every
free
One consequence
3.3
one
Alpha
If
V
of
free
is
case
is
formula
a WFF with
V
in
variable
in
are
specified
devoid
of
these
the
requirements
three
is
range-coupled;
V
belongs
by
range
the
U,,
to
properties:
the
set
whose
. . . , un;
U2,
terms.
if
that
a range-separable
wFF
variable.
Expressions
the
range-separable
relation-defining
the
it
a)
c)
least
or
. . . A un),
ranges
has at
which
WFFs of
expressions
much-needed
we consider
capability
simple
alpha
(t,,
without
of
relational
further
defining
expressions
t2’
the
augmentation,
projections
of
***, $1
calculus
the
of
were
they
used
would
relations.
as
lack
Accordingly,
form
: w
where
1)
w
2)
t,,
is
tp
variable
a range-separable
. . . , tk
are
or an indexed
WFF of
distinct
tuple
the
terms,
variable;
relational
each
calculus;
consisting
of
a tuple
20
3)
the
Set
The
list
set
of
tuple
precisely
the
brackets
{ 1
(t,,
variables
set
of
are
free
is
in
variables
omitted
. . . . tk)
t2,
occurring
because
called
the
t,,
in
w.
they
are
target
t2,
. . . . tk
is
syntactically
list
and
superfluous.
w
the
qualification
expression.
Suppose
their
first
Suppose
occurrence
that
ranges
of
jection
p2,
that
qualification
obvious
... ,
subset
way by the
data
base
(t,,
S,,
S2,
predicates
for
relations
8
the
supplier
Find
of
Find
the
supplier
other
than
part
15.
tuple
list
of
a simple
***,
t,)
: w.
(not
. . . . Sn
The
w.
Then,
of
2.4
queries
is
in
assumed.
S (suppliers)
number
: P,r2
,_
numbers
r2D 1
: P2r2
of
the
the
A (r,[2]
z
question
form
order
z:
are
a certain
satisfy
is
indicated
suppliers
h (r2[2]
# 15).
the
prothe
in
of
simple
pl'
alpha
an
p2
are
expressions.
the
respectively.
who supply
part
15.
= 15).
those
of
variables.
T (supply),
suppliers
distinct)
elements
tuple
in
expression
denotes
Predicates
and
those
of
in
with
alpha
whose
projection
associated
variables
necessarily
S, @ S2 @I . . . @ Sn
r2D 1
8
t2’
distinct
respectively.
'rt'
indices
Section
the
target
z =
examples
of
are
on
the
expression
Now follow
The
in
relations
q,
of
...,
pl y p2,
who supply
something
range
21
8
Find
part
the
supplier
names
of
those
suppliers
who supply
15.
(r,[Z],
Find
n
the
(omitting
r,[3]):
P,r,
of
suppliers
locations
those
suppliers
who are
(r,[3],
The
its
and locations
concept
desirable
of
range
simple
A JP2r2(r2[2]
and
the
supplying
r,[Z]):
P,r,
alpha
expression
parts
being
no parts
at
A P2r2
A (r,[l]
= r,[l]).
supplied
this
expression
b.v them
time).
= r2[1]).
can be generalized
An alpha
properties.
= 15 A r,[lJ
is
without
recursively
losing
defined
as
follows:
1)
Every
2)
If
3)
While
it
simple
t:
w,
No other
is
expressions
from
the
3.4
Relational
that
the
is
t:
w2
are
t:
(w,
v w2)
t:
(w,
A lw2)
t:
(w,
A w,);
are
alpha
alpha
many queries
non-simple
an alpha
expressions,
so are
expressions.
will
it
kind,
expression;
attain
would
the
be artificial
complexity
to
of
exclude
alpha
them
theory.
Completeness
Now we can
calculus
and
expression
expressions
doubtful
of
alpha
is
introduce
relationally
a basic
complete
notion
if,
given
of
selective
any
finite
power.
collection
An algebra
of
or
relations
22
R,,
R2,
....
in
RN
calculus
permit
by alpha
expressions
definition
correspondence
with
to
of
the
algebra
simple
normal
form,
of
relation
(using
any
a set
R,,
R2,
Section
2.
of
. . . , RN).
the
N
expressions
definable
of
from
range
predicates
We shall
apply
the
algebra
R,,
R2,
in
this
or
. . . . RN
one-to-one
notion
in
Section
4
23
4.
REDUCTION
The objective
defined
in
Section
algorithm
for
equivalent
with
specified
Section
is
several
N
of
cited
the
this
relations
product
not
these
satisfy
tuple
alpha
extend
algebra
by exhibiting
z
expression
partly
this
on the
expression,
Rj
P. -
J
an
into
a semantically
algorithm
to
intended
and
partly
(j=1,2,...,
relations
for
the
final
the
of
the
quantification
by the
deal
interpretation
on an arbitrarily
N) between
whatever
range
relational
A more
instead
finally
evaluated
by retrieving
product
is
of
in
list
account
of
eventually
join
these
whittled
the
alpha
is
ranges
extracted.
are
removed
producing
into
are
produced.
performed,
now follows.
the
certain
is
from
that
a projection
the
this
do
product.
and division
Finally,
and we have
base
From
tuples
the
ranges
as nec-
formed.
Third,
The
data
differences
down by projection
expression.
one composite
First,
and set
terms
is
merely
as they
generated
intersections,
of
may be best
combined
as follows.
are
product
formal
are
expressions
be roughly
unions,
target
alpha
that,
are
would
combination
satisfy
moment
expressions
relation
remaining
simple
(which
a Cartesian
the
as specified
based
normal
variables
Fourth,
relation.
for
evaluation
Second,
the
the
algorithm
and by taking
essary.
is
expressions
T),
of
relational
given.
algebraic
effect
the
We proceed
We then
T.
simple
by supposing
expression
show that
alpha
correspondence
The reduction
understood
to
whatsoever.
3) of
and the
base
simple
equivalence
one-to-one
predicates
any
expression
in
is
complete.
expression
semantic
(described
section
relationally
translating
alpha
The
this
2 is
algebraic
any
data
of
required
to
24
Reduction
4.1
Let
the
of
Simple
Alpha
given
alpha
expression
z = t
where
1)
t = (t,,
2)
w=u,
t2,
Step
alpha
be
: w,
. . . . tk)
AU2
separable
Expressions
is
the
up A V
A...A
target
list;
the
qualification
is
(a range-
WFF);
3)
there
are
4)
all
For
convenience,
p
bound
q 10
of
the
variables
variables
free
in
in
V;
w
occur
in
t
(thus,
k 2 p).
to
z
yielding
1
expression
1)
we apply
with
convert
the
V
form)
to
without
2)
the
(the
normal
the
form
(if
it
is
range-coupled
range-coupled
leading
(the
wherever
1,
a new
not
already
in
quantifiers
quantifiers
(in
behave
just
this
the
like
quantifiers);
keeping
by
prenex
the
subformula
3)
transformations
same denotation:
expanding
normalization
ordinary
four
a join
eliminate
complements
quantifiers
so-called
term
unchanged,
matrix)
using
relation
the
symbol
1
of
=,
f,
<,
to
I,
disjunctive
0
and
>,
convert
is
the
normal
immediately
replace
8
and 2 are
form;
preceded
by its
f,
remaining
=,
complement
2,
>,
s,
and
in
the
respectively);
4)
systematically
alpha
expression
apply
an alphabetic
resulting
from
change
3) so that
to
the
the
variables
variables
become
<,
25
r,, r2, . . . . rp+q
the
qualification
variable
Let
the
is
alpha
in
the
(note
with
its
order
that
of
the
their
first
first
occurrence
occurrence
of
in
a bound
quantifier).
expression
resulting
from
these
four
transformations
be
The bound
Step
(3
range
or
in
V'
are
v)
associated
rj
in
A IJh A *.*AU'
rj,
where
with
V'
be
A V's
P
j=p+l,
rj
p+2,
in
V'
. . . . p+q.
be
Qj,
Let
the
and let
the
range
Sj
Us.
2
(say)
of
of
2,
tuple
. . . , p+q
variable
this
rj.
equation
by applying
Sj
: Ui
WFF over
For j=l,
side
= t
variables
quantifier
proper
Z'
the
is
pirj
2)
v-tu
3)
Al
4)
A -+ n,
For
example,
a defining
equation
The algebraic
obtained
following
1)
form
from
rewriting
rules
for
expression
Ui
(the
to
proper
the
on the
range
right-hand
WFF over
rj)
UJ:
+ Ri
-b providing
if
U;
= P3rjhlP2rj,
is
Sj
= R3 - R2.
3) is
inapplicable.
then
the
defining
equation
for
26
In this case,
proper
range
Step
R3 and R2
is
the
compatible
define
with
union
each
of
with
Ri.
9/(Sj)
where
Xj
Call
= gY(Ri).
= S.
3
The
handling
of
proposed
for
any WFF
union
the
of
free
or
accorded
in
Sj
case
of
alpha
the
A.
which
replacing
the
expressions
in
[S]
This
condition
-?/(Ri).
relations
For
the
given
that
are
any subset
Sj
data
union-
of
4V(Ri),
equation
the
= 4
bound,
universal
and
rj
range-coupled
is
the
analogous
needed
for
permits
universally
universal
because
property
quantifier
is
by an extensional
was rejected
complementary
base
existentially
treatment
the
data
in
@xp+q,
8X2@...
is
(i=l,Z,...,N)
defining
special
by Kuhns
possess
3
the
otherwise.
of
not
r.
all
this
Form
Ri
-@(Sj)
alternative
definition
if
relation
with
Ri
S= x1
*
(by definition
3
base
Step
be union-compatible
WFF).
Associated
The
must
correct
quantified.*
quantifier
in
counterpart
of
the
extensional
quantifiers
the
type
do
to:
the
first
transformation
in
1.
Incidentally,
an empty
a query,
a data base system
should
range
Sj
or an empty universe
and inform
him of the pertinent
warn a user
%(Sj)
in
condition.
whenever
it encounters
the interpretation
of
27
Let
the
degree
of
relation
Xj
be
nj
(j=1,2,...,p+q).
Let
'-1
pj
Then,
in
the
the
Step
domain
Cartesian
“c
= i=,
with
J
in
relation
Xj
has position
J + uj
S.
4
the
quantifier-free
range-coupled
WFF
V".
T
Otherwise,
form
an algebraic
rewriting
where
If
quantifiers
(if
any)
from
is
form
the
defining
equation
right-hand
side
V"
p+q =
null,
V'
to yield
the
S.
a defining
equation
for
expression
obtained
from
Tp+q,
V"
the
by applying
of which
the
following
V"
due
rules:
1)
v-tu
2)
A-+fl
3)
(rj[JIOr,[KI)
4)
(rj[JIea)
is
an individual
8
is
one
that
transformation
-f S[(J+uj)‘(K+~k)I
-+ S[(J+pj)elICa)
a
Note
third
i'
position
product
Remove
is
n
constant
of
=,
f,
the
symbol
1
in
1.
Step
<,
5,
2,
does
>.
not
occur
at
all
in
to
the
28
Step
5
Form
q
the
effect
reflect
Qp+q
and
defining
of
the
proceeding
T
equations
to
=
j-l
Step
C
= (l,‘,“‘,
Dj
= (l,Z,...,
j
the
of
outermost
(j=p+q,
V'
starting
Q
p+l'
Tj[Cj]
f Dj]Sj
p+q-1,
The
if
Qj = 3
if
Q.=V,
. . . . p+l)
with
equation
the
for
which
innermost
Tj
,
is:
J
~j)
nj).
6
Form
jection
a defining
specified
equation
in
the
T=
where,
for
for
original
target
‘+11’,
=
J
“.,
(J+Pj >
J
which
takes
list
t:
into
account
Tp[C;C20...0Ck],
(l+~j,
y.
T
h=l,Z,...,k
Ch
and
T j-1
quantifiers
Tj[Cj+,
where
for
is
defined
as in
Step
3.
~j+l)
if
th
= r.
if
th
= rj[J]
3
the
pro-
29
Step7 -By means
directly
in
. . . . n,,,)
T
from
R,,
equations
than
Reduction
The
separable
of
of
such
To convert
generate
z
is
the
We then
applying
form
from
the
the
rewriting
of
T
degrees
n,,
s,, 3’
*a',
sp+q'
p+q'
We can assume that
equations
they
represent
a property
of
S,T p+qP..'
for
the
given
Expression
an alpha
w,,
form,
in
A, and
we use
equations
AT.
the
Zi
z
is
either
4.1)
or
a logical
over
a common
Let
t
reduction
for
of
each
zi
a range-
set
combination
of
be the
target
Section
4.1
free
list.
to
where
,...,m).
equation
logical
Section
. . . , wm)
w2,
v,
a defining
expression
treated
(i=l,Z
given
respective
defines
... . X
Alpha
connectives
: wi
their
which
queries.
(say
defining
Z. = t
1
X2,
since
case
to algebraic
algebraic
obtained
the
an equation
(and
above.
given,
the
formulae
using
X,,
w
WFF (this
variables
. . . . R,,,
an Arbitrary
qualification
m>l
R2,
generated
are
rather
form
substitution,
by eliminating
the
base
4.2
is
of
(i=l,Z,...,N)
data
of
simple
terms
n2,
P
+/(Ri)
of
z,
for
expression
for
the
right-hand
w
rules:
1)
v+u
3)
A-+rl
if
4,
Wi~‘i
(i=l,Z
2) is
inapplicable
,...,m).
in
terms
side
of
of
wi
which
bY
30
Simple
substitution
yields
a defining
4.3
Example
of
Suppose
the
Symbol
Rl
R2
R3
Further
equation
base
3
projects
2
supply
3
the
this
equation
#
project
(i=1,2,3).
Consider
of
all
#
the
Domain
2
Domain
3
name
location
name
#
supplier
p3
location
following:
supplier
p2
name and
part
#
project
#
query:
suppliers,
each
of
whom
projects.
which
(r,C23, +I):
represents
this
query
is:
P,r, * vP2r23P3r3 (r, El1 = r3[1 I) * b3[31 = r,Cll) .
(
1
the
defining
Si
in
Domain
1
pl
the
all
include
Range
Predicate
= Ri
expression
Applying
Zi
for
z.
relations
'I/(Ri)
supplies
following
data
suppliers
Find
expressions
a Reduction
Degree
n
suppose
the
for
Relation
Name
n
An alpha
of
reduction
equations:
= Ri
(i=l,2,3)
s = s, @ s2 0
T3 = S[l=6]
procedure
s3
n S[8=4]
of
Section
4.1,
we obtain
the
31
T2 = T3Cl,2,3,4,51
T1
= T2[(1,2,3,4,5)
-:- (1,2)]52
T = T,[2,3].
Validity
4.4
The
is
left
Lemma
to
of
the
reduction
the
Reduction
algorithm
based
on two simple
calculus,
set
each
of
the
three
operator
U,
r
having
logical
n,
as the
: I-&}
{r
Proof
of
these
-.
only
= {r
connectives
Let
r,a
free
variable.
: I-1 aa {r
v,
be WFFs in
A, r;l
the
and
o
a
relational
Then,
: A) -
2
Let
the
R,S
be relations
relational
of
calculus
degree
with
m,n,
free
respectively.
variables
by
T = {(rOs)
: rER~scS~r1.
Then
where
lemmas.
reader.
c1 be one
corresponding
WFF of
is
1
Let
Lemma
Algorithm
a)
T[u~]
= {r:
b)
T[wmm+n + uJS
o
r E R A 3s(s
={r:
for
E S A I')).
r E R A VS(S
any jx&=G+a
k S v r>>,
integers*~>P~D.
r,
Let
s.
Let
r
T
be a
be defined
the
32
5.
CALCULUS
A query
VERSUS ALGEBRA
language
(or
be at
general
purpose
should
in
paper.
Both
this
foundation
sorting
for
to
the
freedom
the
that
four
respects.
Ease
of
Augmentation
ness
represents
type
of
or
of
set
of
of
of
an indexed
hancements
library
reveals
the
retrieved
term
tuple
an integer
readily
or
fit
of
the
character
into
the
which
string,
calculus
most
natural
of
is
selected).
invoking
within
within
functions.
list
to
function
term
The
is
of
the
such
provide
second
is
the
Inspection
locations
third
to
The most
staying
for
its
complete-
in
while
The
a join
is
to be superior
target
The
within
a terminal.
approach
library
relation.
indexed).
variable
from
--
relational
distinct
by a truth-valued
(possibly
execution
a capability
(whichever
within
re-
be enhanced.
invocation
is
without
power,
functions
three
languages
base
of
defined
a
earlier,
to
sense
be
provide
algebraic
introduction
framework
a join
variables
(yielding
of
locations
transformation
placement
need
to
herein
appears
out
would
potential
these
calculus
claimed
the
branched
the
selective
the
calculus
for
for
basic
is
of
a data
- As pointed
expressions
expressions
the
query
form
be claimed
a very
a finite
alpha
tuple
interrogating
enhancement
algebraic
first
when
environments
any of
of
any other
is
in
described
complete
or
which
complete
calculus
However,
in
practical
relationally
and
might
quantifiers.
algebra
sublanguage)
relationally
consideration
from
least
loops
One advantage
data
algebra
designing
programming
an important
other
some
the
re-
one or more
replacement
by a function
example).
framework.
Such
In
the
en-
algebraic
t
33
framework,
form
to
2)
of
however,
mappings
all
from
such
functions
relations
to
have
to
relations.
be re-cast
in
This
rise
gives
the
circumlocutions.
Scope
for
user
to
Search
request
an ideal
the
the
data
starting
point
hand,
requires
other
algebraic
operations
data
relations.
base
properties
of
operation
- The
Optimization
he desires
for
to
For queries
desired
sequence
data
(one
of
other
tend
many
a sequence
the
desired
than
very
to get
possible
This
a
is
The algebra,
formulate
generate
permits
properties.
optimization.
user
will
calculus
by its
search
the
that
the
relational
ones)
of
data
hidden
on
from
the
simple
ones,
in
the
particular
the
user
which
the
selects.
Therefore,
choice
of
very
of
starting
3)
locally
limited
of
properties
be based
of
the
rather
than
for
retrieving
that
to
system's
the
such
or
The
authorization
tackling
the
to
discover
one has the
operation
(a
difficult
problem
the
intended
data.
discriminating
properties
data.
language,
of each
operations
desired
on a particular
source
execution
- Highly
defining
user
force
of
Capability
on the
the
optimization)
sequences
Authorization
an algebraic
optimizing
form
analyzing
defining
from
of
the
data
algorithm
arguments
authorization
requested
specified
in
capability.
must
2) thus
by the
by the
apply
user
with
equal
34
4)
Closeness
to
should
in
not
order
its
Natural
have
to
or
to
is
6.0
far
the
data
bases.
more
of
- Clearly,
either
with
sequence
calculus-oriented
more
learn
interact
properties
gorithm
Language
natural
operations
source
language.
of
calculus
However,
its
retrieval.
a good
target
users
or algebra
requesting
devising
for
provides
majority
relational
than
language
user-oriented
the
data
a particular
Thus,
language
by
al-
a
for
a
ACKNOWLEDGMENT
The
many
author
valuable
is
indebted
comments
and criticisms.
ranges
in
the
treatment
of
of
the
universes
-?/(Sj).
algebra
number
described
of
tests
to
in
empty
this
In
Palermo
In
in
Section
addition,
Dr.
paper,
on a computer.
Frank
and
subjected
of
IBM Research,
particular,
4.1,
he discovered
and
Palermo
the
San Jose,
suggested
reduction
an error
the
has programmed
for
introduction
the
algorithm
relational
to
a
35
REFERENCES
1.
2.
E. F.,
Comm.
ACM -13,
Codd,
E.
Computer
May 24-25,
4.
Codd,
E.
F.,
ACM-SIGFIDET
Diego,
available
E. F.,
Proc.
1971
Kuhns,
Third
7.
J.
Data
from
Large
Shared
Data
Banks",
6,
the
Data
Base
Relational
"Data
Base
Systems",
Model",
New York
City,
Base
Structure:
on Data
A Brief
Description,
Tutorial",
Access
and
Proc.
Control,
San
ACM, New York.
Base
available
Sublanguage
Workshop
from
Founded
on Data
on the
Relational
Description,
Calculus",
Access,
and Control,
ACM, New York.
Committee,
"An
Information
Algebra",
Comm.
ACM 5,
190-204.
L.,
Beach,
Florida,
Kuhns,
J.L.,
"Logical
Aspects
Dec.
1969,
"Interrogating
Input
Storage
Answering
on Computer
Academic
Queries",
and
Question
Data
Rand
in
and
by Computer",
Information
Proc.
Sciences,
Miami
Press.
a Relational
"Quantification
J.L.,
of
Symposium
of
Information
of
Symposia
Workshop
International
Kuhns,
for
377-387.
ACM-SIGFIDET
Admissibility
8.
Data
Normalization
"A Data
1962,
of
Prentice-Hall.
CODASYL Development
April
6.
1970,
"Normalized
1971
Codd,
Model
Science
1971,
San Diego,
5.
June
"Further
F.,
Courant
3.
"A Relational
Codd,
Corporation
Query
Retrieval,
File:
Systems",
April
1-2,
Remarks
R-511-PR,
Proc.
1971,
on the
November
Symposium
available
1970.
on
from
ACM,
New York.
9.
Strnad,
Proc.
A. L.,
IFIP
"The
Congress,
Relational
Ljubljana
Approach
1971,
to
the
North-Holland.
Management
of
Data
Bases",
36
APPENDIX
For
relation
Let
presentation
to
R
unnormalized
operation
hierarchical
gR
of
is
with
R
and
is
it
form.
be a relation,
A-factoring
where
purposes,
defined
A
may be desirable
The operation
of
: x E R[AIl
as defined
Section
2.3.4.
smaller
lists
relation.
list
a normalized
accomplishes
for
R.
this.
The
by
gRtX))
successively
convert
factoring
a domain-identifying
X(R,A) = i(x,
in
to
Repeated
A
application
can convert
R
of
this
to a multi-level
© Copyright 2026 Paperzz