how to get the second max val for every group in a table
Answers were Sorted based on User's Feedback
Answer / venkat
select * from (
select e.deptno,d.dname,e.sal,dense_rank() over (
partition by e.deptno
order by e.sal desc ) "RANK",
e.ename
from emp_test e,dept_test d
where e.deptno=d.deptno)
where rank=2
Is This Answer Correct ? | 9 Yes | 5 No |
Answer / suman rana
--venkat u r almost correct, since u have used "" (double
quotes) so column name will be come case sensitive.
select * from (
select e.deptno,d.dname,e.sal,dense_rank() over (
partition by e.deptno
order by e.sal desc ) RANK, e.ename
from emp_test e,dept_test d where e.deptno=d.deptno)
where rank=2
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / suman rana
select * from emp e where 2 = ( select count(distinct sal)
from emp e1 where e1.deptno = e.deptno and E.SAL <= E1.SAL)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ram posam
select * from (select deptno,sal,rank() over(partition by
deptno order by sal desc) k
from emp
group by deptno,sal)
where k=&n;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / indu
select max(sal) from salary where sal NOT IN (select max(sal) from salary)
Is This Answer Correct ? | 9 Yes | 13 No |
How do we display rows from the table without duplicates?
What is difference between sid and service name in oracle?
What is oracle database client?
Select all the employees who were hired in last 2 years and who works in dept where max managers are working.
Give the Types of modules in a form?
1) WIll all the user get the DEFAULT profile, if their current profile got deleted at any point of time? 2) What are the Situation we need to MOVE the TABLE between T.spaces? 3) What is the use of MOVING the TABLE between SCHEMA'S? 4) What are the Table Clause, Segment Clause and the Datafile Clause which will override each other? 5) Explain SORT_AREA_SIZE of Tempfile to make UNIFORM SIZE
What is an oracle?
Oracle
0 Answers ABC, Genpact, HUI, Oracle,
normally database take to refresh time 2 hours. but client asked iwant to refresh with in 5 min that same database. do you have any option in BO and Oracle? explain me briefly...kavi
What is a partition in oracle?
how to we delete a row using varray
What is snapshot is too old? Give and example for better understand.