Sqlite

SQLite Aggregate Functions

SQLite Aggregate Functions

SQLite Aggregate Functions perform calculations on sets of values, i.e., group of table rows, and return a single result.

 

SQLite Aggregate Functions

SQLite Aggregate Functions

SQLite Aggregate Functions provides several aggregate functions. Some of the functions are as follows:

SQLite Aggregate Function Description
COUNT() The COUNT() function returns the number of rows in a table.
MIN() The MIN() function returns the lowest (minimum) value of a column.
MAX() The MAX() function returns the highest (maximum) value of a column.
SUM() The SUM() function returns the total sum of column values.
AVG() The AVG() function returns the average value for a column.

 

These functions are used in combination with the GROUP BY clause to perform aggregate calculations on grouped data. The HAVING clause filters the results of the aggregate functions based on specified conditions.

Example

Let’s see the usage of the COUNT() function.

SELECT COUNT(*) FROM <table_name>;

For example, to count the number of rows in the emp table, we can use the following
statement:

SELECT COUNT(*) FROM emp;

 

SQLite Tutorials

SQLite tutorials on this website: