Relational database relational model of Algebra

The basic operation of the relational algebra

Relational algebra operations are divided into a set of operations and pure relational operations:
Here Insert Picture Description
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
Here Insert Picture Description
R ∪S and S ∪R same.

"Poor" Operation
Here Insert Picture Description
R-S and S-R are different.

"Cartesian product" operation
Here Insert Picture Description
Here Insert Picture Description
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
Here Insert Picture Description
priorities operator attention, from high to low priority order is:
Here Insert Picture Description
"projection" operation
Here Insert Picture Description
duplicate tuples if the projector, should be removed.
Here Insert Picture Description
(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
Here Insert Picture Description

Extension of relational algebra operations

"Pay" operation
Here Insert Picture Description

"Connect" operation
Here Insert Picture Description

"Equivalence - connection" operation (a special case of the above operation)
Here Insert Picture Description

"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)
Here Insert Picture Description

Extension of relational algebra operations の Summary
Here Insert Picture Description

Complex relational algebra of extended operation

"In addition to" Operation

Mathematical description:
Here Insert Picture Description
Here Insert Picture 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).
Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description

Full article Summary
Here Insert Picture Description
(Pictures, order from China University of MOOC)

Published 17 original articles · won praise 88 · views 20000 +

Guess you like

Origin blog.csdn.net/LoraRae/article/details/104774463