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 / hariharan

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the steps involved after the disk manager passes the request?

582


Explain the term 'foreign key' related to relational database management system?

561


Explain some differences between mpp and smp?

594


What is the particular designated level at which a LOCK is liable to be applied in Teradata?

604


Explain the most common data types used in teradata?

595






Mention the procedure via which, we can run Teradata jobs in a UNIX environment.

574


What is meant by a node?

622


What are the various indexes in teradata? Why are they preferred?

566


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

634


What are the different functions included in the server software?

605


Mention a few of the ETL tools that come under Teradata.

624


Explain fallback in teradata?

612


Explain Teradata performance tuning and optimization?

703


What are the different functions performed in development phase?

576


If I wanted to run a TPump job only once per day - basically working on a file that is produced once per day - how would you set up the parameters for that sort of job ?

1900