how to check the 3rd max salary from an employee table?
Answers were Sorted based on User's Feedback
Answer / somanath
select sal from emp a where 3=(select
count(distinct(sal)) from emp b
where a.sal<=b.sal)
Is This Answer Correct ? | 34 Yes | 7 No |
Answer / radha sri seshu.kolla
1)SELECT MAX(SAL) FROM EMP WHERE LEVEL=3 CONNECT BY PRIOR
SAL>SAL
2)SELECT E.SAL FROM
(SELECT SAL,DENSE_RANK() OVER(ORDER BY SAL DESC)R FROM EMP)
E WHERE E.R=3
9966112520
Is This Answer Correct ? | 10 Yes | 5 No |
Answer / b.v.siva kumar
Use this for SQL Server:
select top 1 salary from emp where salary in (select
distinct top 3 salary from emp order by salary desc) order
by salary
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / venkateswarulu.s
select min(salary) from emp where salary in(select distinct
top 3 salary from
emp order by salary desc)
Is This Answer Correct ? | 13 Yes | 10 No |
Answer / gourvendra singh
In oracle you can find the 3rd max salary with the help of
the command:-
select sal from(select sal from(select distinct sal from
emp order by sal desc)
where rownum <=3 order by sal asc) where rownum=1;
Is This Answer Correct ? | 7 Yes | 4 No |
Answer / ar
select c.emp_id,c.salary from (select rownum as
rn1,c.emp_id,c.salary from (select * from table_name ORDER
by salary DESC) b) c
where c.rn1 = n --(n=3)
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / danny
SELECT min( sal )
FROM emp
WHERE sal
IN (
SELECT DISTINCT sal
FROM emp
ORDER BY sal DESC
LIMIT 0 , 3
)
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / neeraj79
SELECT DISTINCT salary
FROM employee
ORDER BY salary DESC
LIMIT(2,1)
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / arjun
select min(sal) from (select sal from (select distinct(sal)
from emp order by sal desc) where rownum<4)
Is This Answer Correct ? | 2 Yes | 1 No |
Display the total debit counts, total credit counts, sum of total debits, sum of total credits from an employee's transaction table (a single table) containing the following columns. Transaction_number Transaction_amount Transaction_date Transaction_type --> tells if the amount is a credit or a debit. As the query alone is important, the table is left with specifying just the field's name. Pls help me with this query.
Please let me know if UNION ALL and Natural Join does the same operation and are same...
What is sql entity?
When do we create bitmap indexes
pl/sql testing means what ...... explain process how to find pl/sql bugs
Can I join the same table twice?
Table name: T1, it has only one column. col1 ------ c b a b b b b d s a a t s Requirement: I need the following output from the above base table by using SQL query. col1 Cnt ----- ------- a 3 b 5 Others 5 Please help. Thanks Guru v.gurus@in.com
What does t sql mean?
What are the dml statements?
What will you get by the cursor attribute sql%notfound?
List out the acid properties and explain?
How do you update a value in sql?