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
Is natural join same as inner join?
What is consistency?
List the various privileges that a user can grant to another user?
What type of database is sql?
Can 2 queries be executed simultaneously in a distributed database system?
Is sql a backend?
how can we repair a mysql table? : Sql dba
What does bitemporal mean?
how to shut down the server with 'mysqladmin'? : Sql dba
How are functions and procedures called in PL/SQL?
Explian rowid, rownum?
difference between anonymous blocks and sub-programs.
What is difference between db2 and sql?
Is sql better than access?
Enlist the advantages of sql.