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
Why use truncate instead of delete?
Why are sql stored procedures used?
Is ms sql traffic encrypted?
What is the difference between clustered and non-clustered indexes?
How many sql are there?
What is relationship? How many types of relationship are there?
what are the advantages of using stored procedures? : Sql dba
How does an execution block start and end in pl sql?
Which sql statement is used to delete data from a database?
What are different methods to trace the pl/sql code?
What does varchar include?
How to write html code in pl sql?
Name three sql operations that perform a sort.
how to create a test table in your mysql server? : Sql dba
What is sql query limit?