logo

SQL Aggregate Functions

SQL provides many built-in functions to perform operations on data. These functions are useful for performing mathematical calculations, string concatenations, sub-strings, etc. SQL functions are divided into two categories:

1.Aggregate Functions

2.Scalar Functions

Both aggregate functions and scalar functions return a single value. Aggregate functions operate on many records, while scalar functions operate on each record independently.

Aggregate functions perform calculations on a set of values and return a single value. These functions are often used with the GROUP BY clause of the SELECT statement to group multiple rows together as input to form a single value output. Aggregate functions ignore NULL values, except for COUNT(*).

List of Aggregate Functions:

1.COUNT(): Returns the number of rows that match the specified criterion.

2.SUM(): Returns the total sum of a selected numeric column.

3.AVG(): Returns the average value of a selected numeric column.

4.MAX(): Returns the maximum value of a selected column.

5.MIN(): Returns the minimum value of a selected column.

1. COUNT() Function

The COUNT() function returns the number of rows that match the specified criterion.

SQL COUNT() Function

2. SUM() Function

The SUM() function returns the total sum of a selected numeric column.

SQL SUM() Function

3. AVG() Function

The AVG() function returns the average value of a selected numeric column.

SQL AVG() Function

4. MAX() Function

The MAX() function returns the maximum value of a selected column.

SQL MAX() Function

5. MIN() Function

The MIN() function returns the minimum value of a selected column.

SQL MIN() Function
Next ❯ ❮ Previous
discription of faastop website
logo