Traditional Culture Encyclopedia - Traditional stories - What are the basic operations in relational algebra and what are their basic functions?

What are the basic operations in relational algebra and what are their basic functions?

Five basic operations: union, difference, product, selection and casting; Form a complete set of relational algebra operations. Other non-basic operations: All operations synthesized by the above five basic operations can be bai. Union (u), intersection (⌒), projection (π), selection (σ) and Cartesian product (×).

Traditional set operation:

1 and UNION have two relations, R and S, which have the same structure. The union of R and S is a set of tuples belonging to R or S, and the operator is ∨. Write t = r ∪ s.

2. The difference between R and S is a set of tuples belonging to R but not S, and the operator is-. Write it down as t = r-s.

3. Intersection The intersection of R and S is a set of tuples belonging to both R and S, and the operator is ∩. Write it as t = r ∩ s. R∩S=R-(R-S).

Extended data:

1, let the relation pattern be R(A 1, A2, …, An). One of its relations is set to r, T∈R means that t is a tuple of r, and T[Ai] means that tuple t corresponds to the component of attribute Ai.

2. if A={Ai 1, Ai2, …, Aik}, where Ai 1, Ai2, …, Aik is a part of A 1, A2, …, An, then a is called an attribute column or a domain column. フA represents the remaining attribute group after removing {A 1, A2, …, An}. T [a] = (t [ai 1], t [ai2], ..., t [aik]) represents the component set of tuple T on attribute column A.

3.r is an n-mesh relation and s is an m-mesh relation. Let tr∈R(r is subscript) and ts∈S(s is subscript), then trts (adding a half arc above the whole formula, r and s are subscript) is called tuple concatenation. It is a tuple with (n+m) columns. The first n components are n tuples in R, and the last m components are m tuples in S..

Baidu encyclopedia-relational algebra