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.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi Friends, Please send me Teradata Materials for certifications Thanks in advance !!

1702


What do you mean by ttu in teradata?

573


Can we collect statistics on table level?

606


What are the steps to create a data model?

602


Can we have an unconnected lkp to lookup a db2 record against a teradata record? Doesnt seem to work. I could be wrong

634






How many sessions of MAX is PE capable of handling at a particular time?

599


How many types of joins are there in teradata?

549


What is the syntax for case when statement?

591


Why is the case expression used in teradata?

595


What do high confidence, low confidence and no confidence mean in explain plan?

594


Did you write stored procedures in teradata?

621


Hi, If anyone has TD 14 Basics dumps or study materials, please share. nirmaaal1991@gmail.com

1965


What is dimensional modeling?

595


Backup Script was blocked you are unable to archive the data now. how do you analyze it and where do you identify ?

1609


What is the difference between global temporary tables and volatile temporary tables?

641