How to get second highest salary from a table
Answers were Sorted based on User's Feedback
Answer / senthil
select max(sal) from emp where sal <(select max(sal) from emp)
Is This Answer Correct ? | 13 Yes | 1 No |
Answer / srinivas
select * from emp m where(select count(distinct sal)+1 from emp s where s.sal>m.sal)=2
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / saiz
select min(salary)
from emp
where salary in ( select top 2 salary
from emp
order by salary desc);
Is This Answer Correct ? | 3 Yes | 0 No |
Why are sql stored procedures used?
can we write stored function in out parameters? how to call through select statement? how to written more than one value plz give the exmple?
what is the use of anchoring object? what r the difference between anchoring object & enclosing object? can any one tell me all the details?
What are the steps you take to tune(performance tuning) the code in plsql?
4 Answers Cap Gemini, Infosys, TCS,
What is out parameter used for eventhough return statement can also be used in pl/sql?
I have 2 packages A and B. Now package A references Package B and Package B references Package A. How do you compile such inter-dependent objects in PL/SQL
5 Answers Doyensys, Infosys, Metric Stream,
Can a foreign key have a different name?
what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba
What is substitution variable in pl sql?
How can we avoid duplicating records in a query?
How to combine two stored procedures in sql?
Can we update views in sql?