17.05 - Example: Grouping Departments by Average Salaries - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

Display salary ranges for specified departments whose salaries average more than $37,000:

     SELECT dept_no, MIN(salary), MAX(salary), AVG(salary)
     FROM employee
     WHERE dept_no IN (100,300,500,600)
     GROUP BY dept_no
     HAVING AVG(salary) > 37000;

The result is:

     dept_no  MIN(salary)     MAX(salary)       AVG(salary)
     -------  --------------- ---------------   ---------------
        300        23,000.00       65,000.00         47,666.67
        500        22,000.00       56,000.00         38,285.71