The basic operation of the relational algebra
Relational algebra operations are divided into a set of operations and pure relational operations:
and compatibility
Some relational algebra operations, and such difference, cross, etc. must meet "and compatibility."
There is a certain correspondence relationship between the two involved in the operation and their associated attributes, associations or meaning comparability.
R & lt (A1, A2, ..., An), S (Bl, B2, ..., Bm)
R & lt meet and compatibility and S: n = m and Domain (Ai) = Domain (Bi ).
"And" Operation
R ∪S and S ∪R same.
"Poor" Operation
R-S and S-R are different.
"Cartesian product" operation
number of tuples of a relation R 3, is 3 degrees; Relationship between the number of tuples S is 4, the degree is 3; X is the number of tuples S is R 12, is 6 degrees.
Two relations R and S, the number of attributes thereof, respectively n and m (n is the degree of relation R, S m is the degree of relationship), the number of tuples which are x and y (x cardinality relation R, S base y),
then the Cartesian product of the number of properties R x S = n-m + , the number of tuples = X × Y .
R and X are all tuples S S R are concatenated to each tuple.
S and X R are all tuples in R S is concatenated to each tuple. The result is the same.
"Select" operation
priorities operator attention, from high to low priority order is:
"projection" operation
duplicate tuples if the projector, should be removed.
(Projection operation singling columns from a new relationship in the relationship given, the selecting operation from some lines are selected in a given relationship to form new relations).
The basic relational algebra operations の Summary
Extension of relational algebra operations
"Pay" operation
"Connect" operation
"Equivalence - connection" operation (a special case of the above operation)
"Natural connection" operation
NATURAL equivalent connection is a special connection.
R, same or S, must be equal to the value of the connection, i.e. R.B1 = S.B1 and R.B2 = S.B2 ... and R.Bn = S.Bn to connect.
To remove duplicate attribute columns in results (because the results are always equal S.Bi R.Bi it is possible to keep only one)
Extension of relational algebra operations の Summary
Complex relational algebra of extended operation
"In addition to" Operation
Mathematical description:
"external connection" operation
When two relations R and S are connected, if the relationship of R (or S) of the tuples in S (or R), found matching tuple, the tuple is in order to avoid loss of information, so that the element group S (or R) is assumed to exist tuples formed are all connected to null, the result is placed in the relationship, this connection is called an outer connector (outer Join).
Full article Summary
(Pictures, order from China University of MOOC)