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
Does truncate remove indexes?
How can we make an if statement within a select statement?
What are the datatypes available in pl/sql ?
What is cold data?
what are the advantages a stored procedure? : Sql dba
Write a query to find the names of users that begin with "um" in sql?
What does inner join mean?
How do I partition a table in sql?
how to delete duplicate rows from a join tables(I have three tables on that join) how do you know which join is need to be used? The select statement I have is: SELECT gc_skill_type.skill_type, gc_area_tec.area, gc_technology.technology, gc_technology.id_technology, gc_area_tec.id_area_tec FROM gc_skill_type, gc_area_tec, gc_technology WHERE gc_area_tec.id_skill_type (+) = gc_skill_type.id_skill_type AND gc_technology.id_area_tec (+) = gc_area_tec.id_area_tec order by gc_skill_type.skill_type asc, gc_area_tec.area asc, gc_technology.technology asc
Differentiate between syntax and runtime errors.
how to get @@error and @@rowcount at the same time? : Sql dba
When are we going to use truncate and delete?
What is a dynamic query?
Does mysql support pl sql?
Why plvtab is considered as the easiest way to access the pl/sql table?