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 convert numeric values to character strings? : Sql dba
What is difference between stored procedure and trigger?
Can we use pl sql in mysql?
What is sql profiling in oracle?
How can we solve sql error: ora-00904: invalid identifier?
Does normalization improve performance?
What is the basic form of sql query?
What is sql injection owasp?
What's the difference between a primary key and a clustered index?
What is the use of desc in sql?
What are the types pl/sql code blocks?
Explain the insert into statements in sql?
discuss about myisam key cache. : Sql dba
What are the usages of sql?
Mention what plvcmt and plvrb does in pl/sql?