Could you please tell me the differences between
select CustomerId from Customer Where TerritoryId <> All(select TerritoryId from Salesperson)
select CustomerId from Customer where TerritoryId NOT IN (select TerritoryId from Salesperson)
t-sql
Could you please tell me the differences between
select CustomerId from Customer Where TerritoryId <> All(select TerritoryId from Salesperson)
select CustomerId from Customer where TerritoryId NOT IN (select TerritoryId from Salesperson)
Best Answer
There is no difference in result but there is a bit different semantics.
X [comparison] ALL(set)
mean thatset
is empty or the comparison isTRUE
for each entry in the set.X NOT IN (set)
means that X does not belong to the set.While
[comparison]
is "not equal", both forms are equivalent. But for other comparisons it may be different.