sql 求相交的行_SQL相交

SQL Intersect子句用于合并两个或多个SELECT查询,并返回它们的交集,即公共结果。使用Intersect时,查询应具有相同数量的列且列数据类型一致,列顺序也必须相同。示例中展示了如何在数据库中使用Intersect操作来找到Customer和Supplier表的共同行。
摘要由CSDN通过智能技术生成

sql 求相交的行

In a day to day scenario, we do meet with requirements where we need to get the common result set from multiple tables. In order to achieve such requirements, SQL has provided a feature called Intersect. Intersection means common between two or more. Similar to its literal meaning SQL intersect provides the common result between multiple SELECT statements.

在日常情况下,我们确实满足了需要从多个表中获取通用结果集的要求。 为了达到这样的要求,SQL提供了一个称为Intersect的功能。 交集是指两个或多个之间共有。 与它的字面意思相似,SQL相交提供了多个SELECT语句之间的公共结果。

SQL相交 (SQL Intersect)

The SQL Intersect clause is used for combining two or more SELECT queries, but the result set will be the intersection of the queries. In common words, SQL Intersect will provide the common result between multiple SELECT statements.

SQL Intersect子句用于合并两个或多个SELECT查询,但结果集将是查询的交集。 换句话说,SQL Intersect将在多个SELECT语句之间提供相同的结果。

SQL相交的使用规则 (Rules for Usage of SQL Intersect)

  • The queries should have the same number of columns as part of the select query.

    查询应具有与选择查询相同的列数。
  • The data type for the result sets should be the same.

    结果集的数据类型应该相同。
  • Intersect uses column position for combination and not column name.

    相交使用列位置进行组合,而不使用列名称。
  • The column in each select query must be in the same order.

    每个选择查询中的列必须具有相同的顺序。
SQL Intersect

SQL Intersect Representation

SQL相交表示

SQL相交语法 (

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值