Example: Grouping Departments by Average Salaries - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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