Home All Groups Group Topic Archive Search About

Left (or Right) Anti Semi JOIN

Author
4 Aug 2006 2:44 AM
Arnie Rowland
How do I get one?

From:
http://msdn.microsoft.com/library/?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp?frame=true


--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous

Author
4 Aug 2006 6:11 AM
Kalen Delaney
Hi Arnie

I'm not sure what your link has to do with your question.

The 'left anti semi join" is a logical operation that refers to the way your
tables in a query are related. You don't request it specifically with
syntax.

A semi join happens when you join two tables but you only want data from one
of them, i.e. when the 2nd table is used as a lookup table, as in this
example from pubs which answers the question "Which publishers have
published books:

USE pubs
SELECT pub_name
FROM publishers
WHERE pub_id  IN
(SELECT pub_id from titles)

I am only looking for output from the publishers table, but the titles table
is used to figure out which rows from publishers I want. The query plan will
indicate a semi-join.

Now, suppose I want to see only the publishers that have not published
books:

SELECT pub_name
FROM publishers
WHERE pub_id NOT IN
(SELECT pub_id from titles)

Now the query plan with show me an anti semi-join.
--
HTH
Kalen Delaney, SQL Server MVP


Show quote
"Arnie Rowland" <ar***@1568.com> wrote in message
news:u4ECsa3tGHA.1504@TK2MSFTNGP03.phx.gbl...
> How do I get one?
>
> From:
> http://msdn.microsoft.com/library/?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp?frame=true
>
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
>
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
>
>
Author
4 Aug 2006 7:12 AM
Arnie Rowland
Thanks Kalen. My question was 'tongue in cheek'. I should have made that
more clear. I recently encountered a class participant who asked why we
couldn't specify the more esoteric types of joins shown in the execution
plan.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


Show quote
"Kalen Delaney" <replies@public_newsgroups.com> wrote in message
news:OUMMGz4tGHA.4752@TK2MSFTNGP02.phx.gbl...
> Hi Arnie
>
> I'm not sure what your link has to do with your question.
>
> The 'left anti semi join" is a logical operation that refers to the way
> your tables in a query are related. You don't request it specifically with
> syntax.
>
> A semi join happens when you join two tables but you only want data from
> one of them, i.e. when the 2nd table is used as a lookup table, as in this
> example from pubs which answers the question "Which publishers have
> published books:
>
> USE pubs
> SELECT pub_name
> FROM publishers
> WHERE pub_id  IN
> (SELECT pub_id from titles)
>
> I am only looking for output from the publishers table, but the titles
> table is used to figure out which rows from publishers I want. The query
> plan will indicate a semi-join.
>
> Now, suppose I want to see only the publishers that have not published
> books:
>
> SELECT pub_name
> FROM publishers
> WHERE pub_id NOT IN
> (SELECT pub_id from titles)
>
> Now the query plan with show me an anti semi-join.
> --
> HTH
> Kalen Delaney, SQL Server MVP
>
>
> "Arnie Rowland" <ar***@1568.com> wrote in message
> news:u4ECsa3tGHA.1504@TK2MSFTNGP03.phx.gbl...
>> How do I get one?
>>
>> From:
>> http://msdn.microsoft.com/library/?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp?frame=true
>>
>>
>> --
>> Arnie Rowland, Ph.D.
>> Westwood Consulting, Inc
>>
>> Most good judgment comes from experience.
>> Most experience comes from bad judgment.
>> - Anonymous
>>
>>
>>
>
>
Author
4 Aug 2006 6:03 PM
Kalen Delaney
So I'm confused. Why did you ask this question?

--
HTH
Kalen Delaney, SQL Server MVP


Show quote
"Arnie Rowland" <ar***@1568.com> wrote in message
news:u4WOfV5tGHA.2448@TK2MSFTNGP06.phx.gbl...
> Thanks Kalen. My question was 'tongue in cheek'. I should have made that
> more clear. I recently encountered a class participant who asked why we
> couldn't specify the more esoteric types of joins shown in the execution
> plan.
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
>
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
>
> "Kalen Delaney" <replies@public_newsgroups.com> wrote in message
> news:OUMMGz4tGHA.4752@TK2MSFTNGP02.phx.gbl...
>> Hi Arnie
>>
>> I'm not sure what your link has to do with your question.
>>
>> The 'left anti semi join" is a logical operation that refers to the way
>> your tables in a query are related. You don't request it specifically
>> with syntax.
>>
>> A semi join happens when you join two tables but you only want data from
>> one of them, i.e. when the 2nd table is used as a lookup table, as in
>> this example from pubs which answers the question "Which publishers have
>> published books:
>>
>> USE pubs
>> SELECT pub_name
>> FROM publishers
>> WHERE pub_id  IN
>> (SELECT pub_id from titles)
>>
>> I am only looking for output from the publishers table, but the titles
>> table is used to figure out which rows from publishers I want. The query
>> plan will indicate a semi-join.
>>
>> Now, suppose I want to see only the publishers that have not published
>> books:
>>
>> SELECT pub_name
>> FROM publishers
>> WHERE pub_id NOT IN
>> (SELECT pub_id from titles)
>>
>> Now the query plan with show me an anti semi-join.
>> --
>> HTH
>> Kalen Delaney, SQL Server MVP
>>
>>
>> "Arnie Rowland" <ar***@1568.com> wrote in message
>> news:u4ECsa3tGHA.1504@TK2MSFTNGP03.phx.gbl...
>>> How do I get one?
>>>
>>> From:
>>> http://msdn.microsoft.com/library/?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp?frame=true
>>>
>>>
>>> --
>>> Arnie Rowland, Ph.D.
>>> Westwood Consulting, Inc
>>>
>>> Most good judgment comes from experience.
>>> Most experience comes from bad judgment.
>>> - Anonymous
>>>
>>>
>>>
>>
>>
>
>
Author
4 Aug 2006 8:44 PM
Steve Dassin
"Arnie Rowland" <ar***@1568.com> wrote in message
news:u4WOfV5tGHA.2448@TK2MSFTNGP06.phx.gbl...
> Thanks Kalen. My question was 'tongue in cheek'. I should have made that
> more clear. I recently encountered a class participant who asked why we
> couldn't specify the more esoteric types of joins shown in the execution
> plan.

Semijoin
http://www.alphora.com/docs/D4LGTableExpressions-Having.html

Semiminus
http://www.alphora.com/docs/D4LGTableExpressions-Without.html

So the next time your asked this perfectly valid question you can
give proper directions and not make excuses:)

AddThis Social Bookmark Button