ANY SOME AND ALL
ANY or SOME:
Compares a value to each value in a list or returned by a query. Must be preceded by =, !=, >, <, <=, >=. Evaluates to FALSE if the query returns no rows.
Using Any
select ename, sal from emp where sal > any (1600, 2999);
Alternatively
select ename, sal from emp where sal > 1600 or sal > 2999;
ALL:
Compares a value to every value in a list or returned by a query. Must be preceded by =, !=, >, <, <=, >=. Evaluates to TRUE if the query returns no rows.
Using All
select ename, sal from emp where sal > all (1600, 2999);
Alternatively
select ename, sal from emp where sal > 1600 and sal > 2999;
Thank you so much for clearing out all the confusions that were in my mind about all these three clauses. Each of them is so neatly explained and the usage of all of them is more cleared when I executed the queries that you have shared.
ReplyDeletesap upgrade planning