how to find the second highest salary from emp table?

Answer Posted / prudhvi

select sal from emp a where 1=(select count(*) from emp b where a.sal>b.sal);

Try this guys,if u want highest sal use 0 in where condition, for second highest 1,third 2........

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Show code of a cursor for loop.

582


What does where 1 1 mean in sql?

541


What is query optimization in sql?

546


how to load data files into tables with 'mysqlimport'? : Sql dba

520


How to rename a table?

556






What is the difference between having and a where in sql?

570


What is the difference between a procedure and a function?

490


how would concatenate strings in mysql? : Sql dba

568


Which sql statement is used to return only different values?

500


What is dml statement?

515


What do you understand by pl/sql packages?

568


What is rownum in sql?

557


how many ways we can we find the current date using mysql? : Sql dba

614


What is dense_rank?

536


How many clustered indexes can be created on a table?

585