Write a query to find second highest salary of an employee.
Answers were Sorted based on User's Feedback
Answer / preetir
select min(sal) from (select distinct sal from emp order by
desc where rownum < 2)
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / arif saulat
select * from emp where sal <(select max(sal) from emp)
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / deepshikha
SELECT MAX (sal)
FROM emp a,
(SELECT MAX (sal) max_sal
FROM emp) abc
WHERE a.sal < abc.max_sal
ORDER BY sal DESC;
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / vamana murthy
select ename,salary from emp
where rownum=2
order by salary desc
Is This Answer Correct ? | 0 Yes | 7 No |
Use the below Query:
Select Max(salary) from Emp
Where Max(salary) < (Select Max(salary) from emp
where emp-no=101);
Is This Answer Correct ? | 10 Yes | 18 No |
Answer / kitcat
SELECT salary
FROM (SELECT salary FROM emp
ORDER BY DESC salary)
WHERE RowNum=2
Is This Answer Correct ? | 1 Yes | 11 No |
what is the difference between primary key and unique key? : Sql dba
how to delete duplicate rows from a specified table(only single table) how do you know which join is need to be used
hi this is nakka i have been looking for 1+ exp in oracle sql,plsql developer positions also have knoledge on d2k i am not getting proper walkins how to know it? where can i find it?
What are the indexing methods?
What are two virtual tables available during database trigger execution ?
Which one is better subquery or joins?
What are the different types of sql commands?
What are tuples in sql?
What is blind sql injection?
Name some usages of database trigger?
How do you run a query?
How do you write an inner join query?