Traditional Culture Encyclopedia - Traditional festivals - Relational Algebra of Relational Algebra "Traditional Set Operations"

Relational Algebra of Relational Algebra "Traditional Set Operations"

Traditional set operations are binomial operations, including four operations: union, intersection, difference, and generalized Cartesian product.

⒈ and (Union)

Set the relation R and relation S have the same purpose n (that is, both relations have n attributes), and the corresponding attributes are taken from the same domain, then the relation R and the relation S and consists of tuples belonging to R or belonging to S. The resultant relation is still n-objective relation. The resulting relation is still an n-measure relation. It is written as:

R∪S={t|t∈R∨t∈S}

Difference

Set relation R and relation S have the same n-objects and the corresponding attributes are taken from the same domain, then the difference between relation R and relation S consists of all the tuples belonging to R and not belonging to S. The resulting relation is still n-objective relation. The resulting relation is still an n-measure relation. It is written as:

R-S={t|t∈R∧t?S}

3 Intersection (Intersection Referential integrity)

Setting the relation R and the relation S to have the same n-objective n and the corresponding attributes to be taken from the same domain, the intersection of the relation R and the relation S is composed of all the tuples that belong to both R and S. The resultant relation is still an n-objective relation. R and S are composed of tuples belonging to both R and S. The resultant relation is still an n-objective relation. Notation:

R∩S={t|t∈R∧t∈S}

Sung Extended cartesian product

The generalized cartesian product of two n- and m-order relations R and S is a collection of tuples of (n+m) columns. The first n columns of the tuple are a tuple of the relation R and the last m columns are a tuple of the relation S. If R has k1 tuples and S has k2 tuples, then the generalized Cartesian product of relation R and relation S has k1 × k2 tuples.