Home  >  Article  >  What are the specialized relational operations that a relational database management system can implement?

What are the specialized relational operations that a relational database management system can implement?

青灯夜游
青灯夜游Original
2020-12-10 10:55:3636230browse

Specialized relational operations that can be implemented include: 1. Selection operation; from all records in the two-dimensional relational table, select those records that meet the specified conditions. 2. Projection operation: select a part of fields and their values ​​from all fields to operate. It is a vertical operation. 3. Connection operation: perform projection operation on two relationships to connect and generate a new relationship.

What are the specialized relational operations that a relational database management system can implement?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

Relational Database Management System (RDBMS) refers to a set of programs (database management system software) that includes interconnected logical organization and access to these data. A relational database management system is a system that manages relational databases and organizes data logically.

Specialized relational operations that the relational database management system can implement include: selection, projection, and connection.

1) Selection operation: Select those tuples that meet the limiting conditions from the given relationship.

2) Projection operation: Select the specified attribute group from all attributes of the given relationship in the required order.

3) Connection operation: Splice the attribute names of two different relationships into a large relationship pattern. The attribute values ​​with the same nature in the two relationships should meet the limiting conditions. The new tuples after splicing these tuples The groups collectively form a new relationship after the join.

Introduction to relational operations

There are two types of basic relational operations: one is traditional set operations (union, difference, intersection, etc.), and the other is specialized Relational operations (selection, projection, connection, division, outer join, etc.). Some queries require a combination of several basic operations and require several steps to complete.

1. Traditional set operations

1. UNION There are two relations R and S, which have the 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 (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.

Related recommendations: "Introduction to Programming"

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

Statement:
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 [email protected]