I have one table :EID,Depid,ename,sal
I want to have max(sal) in each department.
Answers were Sorted based on User's Feedback
Answer / omar
select e.department_id,max(e.salary)
from employees e
group by e.department_id
order by e.department_id desc;
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vengalrao
Dear Friends,
Depends upon table u can pick one max value is possible,one
table u cannot pick max value of all columans , then u can
refer one any ne column
select depid,max(sal) from <table name> group by depid;
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / narasimha
select e.eid,e.sal,e.depid,e.ename,e.sal from emp e
where 1>(select count(*) from emp w where e.sal<w.sal and
e.depid=w.depid) order by e.deptno asc
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / venkat
select * from emp_test where sal IN(select max(sal) from
emp_test group by deptno)
Is This Answer Correct ? | 1 Yes | 6 No |
when do u go for hash partitioning?
How a database is related to tablespaces?
How to use in conditions in oracle?
write a query to dispaly those name who is more than one in student table? example- in a student table sandeep kumar comes 4 times, rakesh kumar comes 2 times, ajit kumar comes 1 times so query will display sandeep kumar and rakesh kumar single times.
Youre getting high busy buffer waits - how can you find whats causing it?
What are the differences between lov and list item?
What are the factors that affect OPTIMIZER in choosing an Optimization approach ?
select statement does not retrieve any records. what exception is raised?
How to connect to the server with user account: sys?
What is the relation of a user account and a schema?
13. Display the second to fifth characters in each client name.
What are the original export and import utilities?