T-SQL query Advanced: operations between datasets

Source: Internet
Author: User

Overview

The origin of relational database originates from the concept of set in mathematics. Therefore, between the collection and the collection, the operation between the mathematical sets is also inherited. For relational databases, relationships are often used in relational databases that are not directly related to two datasets. For example, the foreign key. But two data rallies have indirect relationships, such as two games, where there is an indirect relationship between the players ' collections.

Types of data set operations

In T-SQL, relational operations can actually be divided into four categories, first of all by looking at the table we use to illustrate:

The example tables here are recorded for two different meetings, MEETING1 and Meeting2 respectively, as follows:

The specifics of a relational operation can be grouped into the following four categories:

1.a∩b is both in a and B in the desired dataset

In the example table, the actual example is a collection of participants who participate in the first meeting and the second meeting, as shown in the following figure:

2.a∪b, where the data is either in DataSet A or in DataSet B

In the example table, the actual example is a collection of people attending the first meeting, or participating in the second meeting, as shown below:

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/SQLServer/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.