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

Difference between star and snowflake schemas?

692


Why does varchar occupy 2 extra bytes?

713


Let us say there is a file that consists of 100 records out of which we need to skip the first and the last 20 records. What will the code snippet?

818


how many modules are there in telecome domain?how to explain the architecture?

1642


What is meant by a Parsing Engine?

800






How will you solve the problem that occurs during update?

692


What is a node in teradata?

660


What is multi insert?

713


In Teradata, how do we Generate Sequence?

684


Highlight a few of the important components of Teradata?

669


What is the opening step in basic teradata query script?

677


What is logical data model?

751


What is the purpose of using case expression in teradata?

657


how do you manage the production space. what are the proactive methods you can take ?

1562


During the Display time, how is the sequence generated by Teradata?

698