PostgreSQL AGGREGATE functions
What is an aggregate function?
An aggregate function produced a single result for an entire group or table.
Aggregate functions are used to produce summarized results. They operate on sets of rows. They return results based on groups of rows. By default, all rows in a table are treated as one group. The GROUP BY clause of the select statement is used to divide rows into smaller groups.
List of aggregate functions
Name | Description |
---|---|
COUNT | This function returns the number or rows or non NULL values for a column |
SUM | This function returns the sum of a selected column. |
MAX | This function returns the largest value of a specific column. |
MIN | This function returns the smallest value of a specific column. |
AVG | This function returns the average value for a specific column. |
Syntax
aggregate_name (expression [,...] [ order_by_clause] )
OR
aggregate_name (ALL expression [,...] [ order_by_clause] )
OR
aggregate_name (DISTINCT expression [,...] [ order_by_clause] )
OR
aggregate_name (* )
Parameters
Name | Description |
---|---|
aggregate_name | Name of the aggregate function. |
expression | Expression is a value or value of the column which itself does not contain any aggregate expression. |
order_by_clause | The order_by_clause is optional which arranged the result in an order. |
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/PostgreSQL/postgresql-aggregate-functions.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics