⏯️Aggregate Functions

COUNT

The COUNT function returns the number of rows in a group. It counts all values including NULL values.

SELECT COUNT(column_name) FROM table_name; 

SUM

The SUM function returns the total sum of values in a numeric column. It ignores NULL values.

SELECT SUM(column_name) FROM table_name;

AVG

The AVG function returns the average value of a numeric column. It ignores NULL values.

SELECT AVG(column_name) FROM table_name;

MAX

The MAX function returns the maximum value in a set of values. It ignores NULL values.

SELECT MAX(column_name) FROM table_name;

MIN

The MIN function returns the minimum value in a set of values. It ignores NULL values.

SELECT MIN(column_name) FROM table_name;

FIRST

The FIRST function returns the first value in a set of values. It ignores NULL values.

SELECT FIRST(column_name) FROM table_name; 

LAST

The LAST function returns the last value in a set of values. It ignores NULL values.

SELECT LAST(column_name) FROM table_name;

Last updated