Current location - Training Enrollment Network - Mathematics courses - How to calculate the comprehensive operation of relations in discrete mathematics
How to calculate the comprehensive operation of relations in discrete mathematics
The relational operations of discrete mathematics mainly include the following:

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 belongs to r but not to S.

relational operation

relational operation

A set of tuples in s with the operator-. 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).

Examples of relational synthesis operation in discrete mathematics;

Extended data:

There are two basic operations of relations: one is the traditional set operation (union, difference, intersection, etc. ), and the other is special relational operations (selection, projection, connection, division, outer connection, etc. ). Some queries require a combination of several basic operations, which can be completed in several steps.

1, select operation

Finding tuples from relationships that meet given conditions is called selection. The condition is given by a logical expression, and a tuple with a true value will be selected. This operation extracts tuples from the horizontal direction. In FOXPRO, FOR and WHILE are equivalent to selection operations.

For example, list of publishing units =' Higher Education Press' and unit price.

2. Projection operation

Selecting several attributes from the relational schema to form a new relationship is called projection. This is an operation from the perspective of columns, which is equivalent to the vertical decomposition of relations. In FOXPRO, the word FIELDS is equivalent to projection operation. Such as: list field unit, name

3. Connection operation

The join operation is to select tuples whose attributes meet certain conditions from the Cartesian products of two relations.

4. Division operation

In relational algebra, division can be understood as the inverse of cartesian product.

Let the divided relation R be an m-ary relation and the divided relation S be an n-ary relation, then their quotient is an m-n-ary relation, which is denoted as r÷s. The principle of forming quotient is: divide the m-n columns in the divided relation R into several groups according to their values, and check whether the set of n-column values in each group contains the divided relation S, if so, take the values of the m-n columns as tuples of quotient, otherwise don't take them.

5. External connection operation

Both selection and projection operation belong to one objective operation, and their operation objects are only a relationship. Join operation is a binary operation, which needs two relations as the operation objects.

References:

Baidu encyclopedia-relationship operation