0% found this document useful (0 votes)
34 views2 pages

Aggregate Functions

The document outlines five aggregate functions used in SQL: COUNT(), SUM(), AVG(), MAX(), and MIN(). Each function serves a specific purpose, such as counting rows, calculating totals, averages, and finding maximum or minimum values in a column. Example SQL queries are provided for each function to demonstrate their usage.

Uploaded by

kousar banu
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)
34 views2 pages

Aggregate Functions

The document outlines five aggregate functions used in SQL: COUNT(), SUM(), AVG(), MAX(), and MIN(). Each function serves a specific purpose, such as counting rows, calculating totals, averages, and finding maximum or minimum values in a column. Example SQL queries are provided for each function to demonstrate their usage.

Uploaded by

kousar banu
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/ 2

AGGREGATE FUNCTIONS

1. COUNT()

Purpose: Counts the number of rows in a result set.

Count all rows:

SELECT COUNT(*) FROM table_name;

Count non-NULL values in a column:

SELECT COUNT(column_name) FROM table_name;

2. SUM()

Purpose: Calculates the total (sum) of a numeric column.

SELECT SUM(column_name) FROM table_name;

3. AVG()

Purpose: Calculates the average of a numeric column.

SELECT AVG(column_name) FROM table_name;

4. MAX()

Purpose: Returns the maximum value in a column.

SELECT MAX(column_name) FROM table_name;

5. MIN()

Purpose: Returns the minimum value in a column.

SELECT MIN(column_name) FROM table_name;

You might also like