Database Reference
In-Depth Information
The natural join (implied by the notation R1 JOIN R2)
assumes that there is an attribute or combination of attributes
that is common to both R1 and R2 (same attribute name and
characteristics). Let us denote the common attribute(s) in
R1 and R2 as Z. The natural join creates a relation R3, where
every tuple from R1 is concatenated with every tuple from R2,
provided that R1.Z = R2.Z. Finally, a projection is performed
on the result in the previous step to yield a single copy of each
attribute (thus removing either R1.Z or R2.Z) in the
final result.
7.
Intersection (INTERSECT): The intersection builds a relation
R3, from two specified relations R1 and R2, where R3 has tuple
that exist in both R1 and R2. Corresponding attributes of R1
and R2 must be defined on the same domain.
8.
Division (DIVIDE BY): Division takes a relation R1 of degree
m+n and a second relation R2 of degree n and produces a
third relation R3 of degree m , where all the n attribute values
appearing in R2 also appear in R1, concatenated with the
other m attribute values.
7.2.1 Primary and Secondary Operations
The operations may be classified into primary operations and secondary operations :
Primary operations include UNION, DIFFERENCE, SELECT, PROJECT, and PRODUCT.
Secondary operations include JOIN, INTERSECT, and DIVIDE BY. Secondary operations
are derivable from the primary operations.
7.2.2 Codd's Original Classification of Operations
Codd's original classifications placed the operations in two broad categories as follows:
Traditional operations included UNION, INTERSECT, DIFFERENCE, and PRODUCT.
Special operations included RESTRICT, PROJECT, JOIN, and DIVIDEBY.
7.2.3 Nested Operations
The output of each operation is another relation; likewise, the input to each operation is
a set of one or more relations. We say that the relational operation is closed on relational
algebra. Since each operation produces a new relation as output, we can nest operations
so that the output of one forms the input to another. This will become clear in the ensuing
examples.
 
Search WWH ::




Custom Search