Home > Database > SQL > body text

What are the relational operations of the database?

烟雨青岚
Release: 2020-07-03 09:28:03
Original
29798 people have browsed it

The relational operations of the database include: 1. Selection operation, which selects all tuples that meet given conditions from a relation R; 2. Projection operation, which selects certain specified attributes from all attributes of a relation R. ; 3. The connection operation is to select tuples between attributes that meet certain conditions from the generalized Cartesian product of two relationships to form a new relationship.

What are the relational operations of the database?

The relational operations of the database include:

1, Select operation, from a relationship Select all tuples in R that meet the given conditions;

2, Projection operation, select certain specified attributes from all attributes of a relation R;

3 , Connection operation is to select tuples that meet certain conditions between attributes from the generalized Cartesian product of two relationships to form a new relationship.

Knowledge expansion:

1. Traditional set operations

1. Union (UNION) There are two relations R and S, they have Same structure. The union of R and S is a set consisting of tuples belonging to R or belonging to S, and the operator is ∪. Marked as T=R∪S.

2. DIFFERENCE The difference between R and S is a set composed of tuples that belong to R but not to S. The operator is -. Marked as T=R-S.

3. INTERSECTION The intersection of R and S is a set composed of tuples that belong to both R and S. The operator is ∩. Denote it as T=R∩S. R∩S=R-(R-S).

2. Selection operation

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

For example: LIST FOR publishing unit='Higher Education Press' AND unit price<=20

3. Projection operation

Select several attributes from the relationship model to form a new The relationship is called projection. This is done from a column perspective and is equivalent to a vertical decomposition of the relationship. The phrase FIELDS is equivalent to the projection operation in FOXPRO. For example: LIST FIELDS Unit, name

4. Connection operation

The connection operation is to select tuples that meet certain conditions between attributes from the Cartesian product of two relationships.

5. Division operation

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

Suppose the division relation R is an m-ary relation, and the division relation S is an n-ary relation, then their quotient is an m-n-ary relation, recorded as R÷S. The principle of quotient composition is: divide the m-n columns in the division relationship R into several groups according to their values, check whether the set of n column values ​​in each group contains the division relationship S, and if so, take the value of the m-n column as the quotient. A tuple, otherwise not taken.

6. Outer join operation

Recommended tutorial: "sql video tutorial"

The above is the detailed content of What are the relational operations of the database?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!