Questions tagged [anti-join]

An anti-join, also called an excluding-join or left-outer-join, comes from requesting data from a table where some value is not in another table

Formal Definition

The antijoin, written as R ▷ S (where R and S are relations), is similar to the semijoin, but the result of an antijoin is only those tuples in R for which there is no tuple in S that is equal on their common attribute names.

Venn Diagram

anti-join

SQL Phrasing

SELECT <select_list>
FROM TableA A
LEFT JOIN TableB B
ON A.Key = B.Key
WHERE B.Key IS NULL

Related to

References:

78 questions
-1
votes
1 answer

Use multiple columns as identifiers while comparing two data frames in R using setdiff

I have two data frames to compare. Screenshots of the data frames are shown below There are three things I am trying to check: 1st Check: Items that existed in Data 1, but do not exist in Data 2 [Item4; SubItem4; SubsubItem1] 2nd Check: Items…
Mr.CR
  • 85
  • 8
-1
votes
3 answers

SELECT fields where there no exist others in another table

I have the following table schema: Table 1 - field1 Table 2 - field1 | field2 What I want to do is select field2 from the second table where field1 in the second table doesn't exist in the first table (field1). I had this : SELECT t2.field2 ,…
Andre Calenta
  • 77
  • 2
  • 7
-2
votes
3 answers

report the names of all sellers who did not make any sales in 2020

Customer table: customer_id customer_name 101 Alice 102 Bob 103 Charlie Orders…
1 2 3 4 5
6