Write a query to find second highest salary of an employee.

Answer Posted / manoranjan

to select the nth highest salary from emp table

select distinct(a.sal) from emp a where &n=
(select count(distinct(b.sal))from emp b where a.sal<=b.sal);

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the advantages of sql ? : Sql dba

538


What is a constraint?

558


What is bind reference and how can it be created?

570


What is nosql example?

578


How is a PL/SQL code compiled?

662






What is meant by <> in sql?

499


How do I find duplicates in a single column in sql?

525


What are sql queries used for?

525


If a cursor is open, how can we find in a pl/sql block?

666


How many types of sql are there?

518


What is snowflake sql?

572


Define commit?

538


Is it possible to pass parameters to triggers?

564


What are the different types of constraints?

556


What is character functions?

550