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 |
A and B are tables. x is a column. Then What is difference between A.x = B.x(+) and A.x = B.x ?
Can u please explain me the Discussion on Except ,using cast like type cast. Question in the context of difference between two tables
How can I see all tables in oracle?
We have one Package(which has many function/procedures, SQL quires etc). Now we need to check, which query or procedure is taking lot of time in that Package. ? How do we do it.
what is Single Byte Overhead...?
How many objectname will be created for a single table drop function? Why 'flashback' query giving error "ORA-38312: original name is used by an existing object" while getting the table?
I am using an Oracle 8i Database my data contains Clob data. I am using toad version 7.6 i am able to get the data in toad but unable to extract the data in excel.when trying to extract the data into the excel the toad error says out of memory. Can any body please help me to extract the data through the same toad version. Thanks in advance
What is a cursor variable?
Ho to insert no. of records at a time..i mean i want to insert 100 records at a time into a table
how can get like this result table A col1 col2 --- ----- a A b B C C .. .. .. ... .. ... wants result like for a single column col1 ------ a,b,c,........n of data and another is col1 ------- A B C D ........ a b b d ........
How to convert csv to table in oracle?
How to create a new tablespace in oracle?