#What are the relational operations included in relational databases?
1. Selection operation, select all tuples that meet the given conditions from a relation R;
2. Projection operation, select a certain attribute from all attributes of a relation R Some specified attributes;
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.
Relational operations
There are two types of basic relational operations: one is the traditional set operation (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
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.
Recommended tutorial: "MySQL Tutorial"
The above is the detailed content of What are the relational operations in relational databases?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools
