I have a employee table with EMPID, EMPNAME, DEPTID, SAL
and want to fetch the maximum and minimum salary on each
dept id with the emp name. Can anyone help in this? The
result should contain the EMPNAME, DEPTID, SAL.
Answers were Sorted based on User's Feedback
Answer / gayathri
Sel Empname,deptid, (qualify row_number() over (partition by deptid order by sal asec)=1) as min_sal, (qualify row_number() over (partition by deptid order by sal desc)=1) as max_sal from EMP
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / ragunath
sel empname,deptid,sal
from employee where (deptid,sal) in
(sel deptid, max(sal)from employee group by 1
)
union
(sel empname,deptid,sal
from employee where (deptid,sal) in
(sel deptid, min(sal) from employee group by 1
));
| Is This Answer Correct ? | 1 Yes | 1 No |
sel empname, a.deptid, b.salary
from t1_metadata.emp_test a,
(
sel
deptid, max(sal)
from t1_metadata.emp_test
group by 1
union
sel
deptid, min(sal)
from t1_metadata.emp_test
group by 1
)b (deptid, salary)
where a.deptid = b.deptid
and a.sal=b.salary
| Is This Answer Correct ? | 8 Yes | 11 No |
Answer / syamal rao
You can try the bellow query in BTEQ of TERADATA.
select empname from employee with max(sal),min(sal) by deptid;
| Is This Answer Correct ? | 1 Yes | 8 No |
can we join volatile table with general table an global temporary table with general table ?
what is meant by Hot amp?
In which phase of the Active Data Warehouse evolution do you use data to determine what will happen?
What do you mean by ttu in teradata?
which option is used to restart the fastexport script ?
If RDBMS is halted what will you do ?
can we have an unconnected lkp to lookup a DB2 record against a Teradata record?
What are the different design perspectives used in teradata?
hi frnds i want to learn teradata utilities and teradata dba real time. i have 1+ years of experience in teradata. so i want to go deeply in Tearada. plz let me know at my email id who r best to learn from. im lookng for a realtime guy in HYD or Banglr. Thanks in advance. yedu my email-id: jakkayedukondalu@gmail.com@gmail.com
How would you load a very large file in teradata in general? What utility would you use for it? Why?
What do high confidence, low confidence and no confidence mean in explain plan?
What happens when a node suffers a downfall?