Any requires that your results be equal to any one.
All is the
Cases:
To pick out the order amount from the sales list is greater than "E0013 the clerk in 1996/11/10, the amount of any order received" all orders, and display the relevant field information
Select sale_id, Tot_amt
From sales
where Tot_amt > any
(Select Tot_amt from Sales
where sale_id= ' e0013 '
and order _date= ' 1996/11/10 ')
When you change any to all, the statement means that the order amount is greater than "E0013" for all orders that the clerk received on this day in 1996/11/10.
Another example:
CREATE TABLE #A (ID int)
Go
INSERT into #A values (1)
INSERT into #A values (2)
INSERT into #A values (3)
INSERT into #A values (4)
Go
--all: The entire condition is true for all data, for example: 5 is greater than all returned IDs
SELECT *
From #A
where 5>all (select ID from #A)
Go
--any: As long as one data satisfies the condition, the whole condition is set up, for example: 3 is greater than 1, 2
SELECT *
From #A
where 3>any (select ID from #A)
Go
--some is the same as any
Note: In the usage of any, it is possible to use the method of Min/max value first select subquery in the case of a number pair, and in some cases it is more efficient
What is the difference between any and all in SQL query statements?