RELATIONAL
ALGEBRA/ CALCULUS
It is a procedural language.
Traditional
operations
|
|||
UNION
|
INTERSECTION
|
DIFFERENCE
|
CARTESIAN PRODUCT
|
a
U b or b U a
|
a
∩ b or b ∩ a
|
a-b
or b-a
|
a˟b
or b˟a
|
Set: It is a collection of
elements.
e.g. A = {1,4,5,10,25} and B
= {3,4,5} so, A˟B = {(1,3);(1,4);(1,5);(3,4);…….}
General Operator/
Operations:
- SELECTION: It’s the one that is applied on a relation and generates another relation which is a subset of relation on which the operation was applied. It is a horizontal operation.
- PROJECTION: when applied on a relation, returns a sub set of the original relation. It is a vertical operation.
- JOIN: equi-join -> when corresponding values are being searched in two tables with same value. The join is outer-join when only begins them value of set A which is in set B.
- DIVISION: two relation can only carry out division operation (assuming relation A having ‘m’ columns and relation B having ‘n’ columns) iff
(a) Relation
B with n- columns can act as divisor n<m
(b) Relation
B having n-columns must be a sub set of relation A
The resultant set will again be a relation which
will be a subset of relation A.
TUPLE
It is the foundation for
records in a database. It is a set of variables which when placed together
defines a relation.
Limitation of Relational
Algebra:
- No recursion or iteration
- Cannot compute transitive closure.
Comments
Post a Comment