use of IN/ANY/ALL

Answer Posted / mohamed shahid(broadline)

IN:-EQUAL TO ANY MEMBER
EX:-
---
SELECT ENAME,SAL,DEPTNO FROM EMP WHERE SAL IN(SELECT MIN(SAL) FROM EMP GROUP BY DEPTNO);

ANY(<):-COMPARES VALUE TO EACH VALUE RETURNED BY THE SUBQUERY
EX:-
SELECT EMPNO,ENAME,JOB FROM EMP WHERE SAL<ANY(SELECT SAL FROM EMP WHERE JOB='CLAERK');

NOTE:-IT MEANS LESS THAN MINIMUNM VALUE.
ANY(>):-
------

SELECT EMPNO,ENAME,JOB FROM EMP WHERE SAL>ANY(SELECT SAL FROM EMP WHERE JOB='CLERK');

NOTE:-
-----
>ANY:-IT MEANS MORE THAN MINIMUM
=ANY:- IT IS EQUIVALENT TO IN OPERATOR

ALL:-COMPARES VALUE TO EVERY VALUE RETURNED BY THE SUBQUERY

SELECT EMPNO,ENAME,JOB FROM EMP WHERE SAL>ALL(SELECT AVG(SAL) FROM EMP GROUP BY DEPTNO);
NOTE:-
---
>ALL IT MEANS MORE TAHN MAXIMUM


SELECT EMPNO,ENAME,JOB FROM EMP WHERE SAL<ALL(SELECT AVG(SAL) FROM EMP GROUP BY DEPTNO);
NOTE:-
---
ALL<:-IT MEANS LESS THAN MINIMUM

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different parts of a package?

624


what are the system privileges that are required by a schema owner (user) to create a trigger on a table?

608


what's the difference between a primary key and a unique key? : Sql dba

498


Which column of the user triggers data dictionary view displays the database event that will fire the trigger?

591


What is restrict in sql?

548






How to create an array in pl/sql?

566


How can we debug in PL/SQL?

648


What is pl sql and why it is used for?

562


Can we update views in sql?

525


Why is sql*loader direct path so fast?

592


How many sql statements are used? Define them.

569


What information is needed to connect sql*plus an oracle server?

579


What is mdf ldf and ndf?

549


Which tcp/ip port does sql server run on? How can it be changed? : Sql dba

484


What does select * from mean in sql?

1977