select * from emp where sal in(select max(sal) from emp)
here there is any limit for in operator how many values
accpect ?

Answer Posted / ashwin

Hi,
if emp table is containing 8 rows and out of which 2 rows
are having highest salary out of 8 rows then 2 rows will be
displayed.

the emp table is given below
sql>select * from emp;

1 1 ram manager 2 1/6/1985 21500.00 2000.00 20
2 2 ankush clerk 2 2/6/1983 30000.00 1000.00 30
3 3 satish sweeper 3 6/12/1987 20000.00 3000.00 30
4 4 clark manager 4 7/15/1967 14000.00 2000.00 40
5 5 richard dba 5 2/9/1995 30000.00 2000.00 50
6 7 monty sweeper 7 1/12/1987 20000.00 3000.00 30
7 8 ganesh sweeper 8 1/12/1988 2000.00 500.00 20
8 9 ganesh manager 9 2/12/1988 20000.00 500.00 30

sql>select * from emp where sal in(select max(sal) from emp;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
2 ankush clerk 2 2/6/1983 30000.00 1000.00 30
5 richard dba 5 2/9/1995 30000.00 2000.00 50

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are different types of collation sensitivity? : Sql dba

549


how to concatenate two character strings? : Sql dba

542


How to read xml file in oracle pl sql?

500


What are operators available in sql?

577


What is memory optimized table?

569






Which are the different case manipulation functions in sql?

528


Can we create view in stored procedure?

518


What are the sql commands?

601


Is it possible to include an insert statement on the same table to which the trigger is assigned?

555


What is use of trigger?

505


What are the different ddl commands in sql?

572


Explain what is sql*plus?

662


What is the example of procedure?

508


What is not equal in sql?

501


What is sql deadlock?

556