sql - 反连接和反半连接有什么区别?

标签 sql database join

来自 http://www.dbspecialists.com/files/presentations/semijoins.html

An “anti-join” between two tables returns rows from the first table where no matches are found in the second table. An anti-join is essentially the opposite of a semi-join: While a semi-join returns one copy of each row in the first table for which at least one match is found, an anti-join returns one copy of each row in the first table for which no match is found.

不是反半连接而不是反连接“返回第一个表中没有找到匹配项的每一行的一个副本”吗?

如果是,反加入的定义是什么?

请注意,我的问题是一般的 SQL 级别,例如大学教科书中关于数据库概念的级别,而不是特定于特定 SQL RDBMS 实现的问题

谢谢。

最佳答案

反半连接就是反连接。

The antijoin can also be defined as the complement of the semijoin, as follows:

R ▷ S = R − R ⋉ S

Given this, the antijoin is sometimes called the anti-semijoin, and the antijoin operator is sometimes written as semijoin symbol with a bar above it, instead of ▷.

参见 https://en.wikipedia.org/wiki/Relational_algebra#Antijoin_.28.E2.96.B7.29

关于sql - 反连接和反半连接有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40597054/

相关文章:

mysql - 连接具有相同字段的两个表并将数据合并到一个字段(MySQL)

sql - 使用变量创建模式的脚本

php - SQL语句只更新一个用户的数据

java - hql 查询错误

android - 如何将 edittext 的值存储在数据库中,然后如何取回它

mysql - SQL 最佳实践 : Using a column to store two different kinds of data?

sql - 在 PostgreSQL 中编写一个仅在工作日选择数据的函数

php - 全局更改 CakePHP 数据库配置

sql - MySQL: "The SELECT would examine more than MAX_JOIN_SIZE rows"

mysql - 在加入主表之前对子查询中的多对一元素求和