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
What are the enhanced features in teradata v2r5 and v2r6?
What do you mean by tpt in teradata?
Backup Script was blocked you are unable to archive the data now. how do you analyze it and where do you identify ?
Differentiate primary key and partition key?
Explain the term 'row' related to relational database management system?
Comment whether bottleneck is an error or not.
If the PMON is not working then how do you identify and monitor all the processes, resources and sessions ?
how do we write scripts in unix how to execute scripts in real time anybody please needfull or give me number i will cal u
What are the various indexes in teradata? How to use them? Why are they preferred?
Is it necessary to add? Quit statement after a bteq query when I am calling it in a unix environment?
What happens when a node suffers a downfall?
Explain the types of join supports by teradata?
In a table can we use primary key in one column and in another column both unique and not null constrains.if yes how?
A certain load is being imposed on the table and that too, every hour. The traffic in the morning is relatively low, and that of the night is very high. As per this situation, which is the most advisable utility and how is that utility supposed to be loaded?
what are the uses of fact table and dimension table in banking project?