How to retrieve a second highest salary from a table?
Note:Suppose salaries are in duplicate values
eg:
Name Sal
Malli 60000
Pandi 60000
Rudra 45000
Ravi 45000
Answer Posted / praveenpinfo
Suppose table name is EMP.
SQL> Select distinct sal from emp e1 where 2=(select
count(distinct sal) from emp e2 where e1.sal<=e2.sal);
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
how to install mysql? : Sql dba
Does a primary key have to be a number?
What does desc stand for?
Which join is like an inner join?
What are aggregate and scalar functions?
Is natural join and inner join same?
Is left join and outer join same?
What is database sql?
How to display the current date in sql?
What do you understand by exception handling in pl/sql?
Why primary key is required?
How can a function retun more than one value in oracle with proper example?
What are different functions in sql?
Is delete faster than truncate?
what are the differences among rownum, rank and dense_rank? : Sql dba