Any, All Comparison operators

Any and All Comparison Operators:
any:- compares one value with any value in the list
all:- This compares one value with all values in the list

Example for any:-

select * from employees where deptno>any(1,2,3);
Output:
name deptno
---------- -----------
abc 2
def 3
afd 4
cve 5
awh 6
wer 7

select * from employees where deptno>=any(1,2,3);
Output:
name deptno
---------- -----------
wun 1
abc 2
def 3
afd 4
cve 5
awh 6
wer 7

Example for all:
select * from employees where deptno > all(1,2,3,4);
Output:
name deptno
---------- -----------
cve 5
awh 6
wer 7

select * from employees where deptno > =all(1,2,3,4);
Output:
name deptno
---------- -----------
afd 4
cve 5
awh 6
wer 7

No comments:

Post a Comment