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
How many codd's rules are satisfied by teradata database?
What are the scenarios in which full table scans occurs?
What are the functions performed by bynet?
What is the difference between fastload and multiload? Which one is faster?
Did you write stored procedures in teradata?
Explain the term 'foreign key' related to relational database management system?
What are the various etl tools in the market?
Explain fallback in teradata?
Mention a few of the ETL tools that come under Teradata.
Backup Script was blocked you are unable to archive the data now. how do you analyze it and where do you identify ?
Explain teradata vs. Redshift?
Explain the term 'row' related to relational database management system?
Describe primary index in teradata. And what are the available primary index types?
How is MLOAD Client System restarted after execution?
What is meant by a Virtual Disk?