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

Sel Empname,deptid, (qualify row_number() over (partition by deptid order by sal asec)=1) as min_sal, (qualify row_number() over (partition by deptid order by sal desc)=1) as max_sal from EMP

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of fallback?

558


How do you set the session mode parameters in bteq?

603


What is the opening step in basic teradata query script?

592


How would you load a very large file in teradata in general?

559


any one answer me how they can analyzing the project using data ware housing?

2025






Highlight the differences between Primary Key and Primary Index.

612


What is the purpose of using case expression in teradata?

570


What is dimensional modeling?

589


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

570


How do you create tables? Exact syntax, and create profiles, users in teradata?

553


What type of indexing mechanism do we need to use for a typical data warehouse?

612


List out teradata data types?

557


What is meant by a Highest Cost Plan?

619


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

612


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

631