Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
67 views1 page

Group Functions and Group by Clause

Group functions like MAX, MIN, SUM, and AVG produce a single result for each group rather than for each row. They include null values in calculations. The WHERE clause filters rows before grouping so it can restrict the rows considered for each group. The document provides examples of using group functions to generate reports showing the highest, lowest, sum, and average salaries for all employees and each job type, the minimum salary for each manager excluding certain groups, and a count of employees by hire year.

Uploaded by

thomsoncorp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views1 page

Group Functions and Group by Clause

Group functions like MAX, MIN, SUM, and AVG produce a single result for each group rather than for each row. They include null values in calculations. The WHERE clause filters rows before grouping so it can restrict the rows considered for each group. The document provides examples of using group functions to generate reports showing the highest, lowest, sum, and average salaries for all employees and each job type, the minimum salary for each manager excluding certain groups, and a count of employees by hire year.

Uploaded by

thomsoncorp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Group Functions and Group by Clause:

Determine the validity of the following three statements. Circle either True or False.

1. Group functions work across many rows to produce one result per group. True/False

2. Group functions include nulls in calculations. True/False

3. The WHERE clause restricts rows before inclusion in a group calculation. True/False

The HR department needs the following reports:

4. Find the highest, lowest, sum, and average salary of all employees. Label the columns
Maximum, Minimum, Sum, and Average respectively.

5. Write a query to display the minimum, maximum, sum, and average salary for each job type.

6. Create a report to display the manager number and the salary of the lowest-paid employee
for that manager. Exclude anyone whose manager is not known. Exclude any groups where the
minimum salary is $2,000 or less. Sort the output in descending order of salary.

7. Create a query to display the total number of employees and, of that total, the number of
employees hired in 1982, 1981, 1980, and 1983. Create appropriate column headings.

You might also like