ODBC Driver for 1010data

Build 22.0.8509

Aggregate Functions

Examples of Aggregate Functions

Below are several examples of SQL aggregate functions. You can use these with a GROUP BY clause to aggregate rows based on the specified GROUP BY criterion. This can be a reporting tool.

COUNT

Returns the number of rows matching the query criteria.

SELECT COUNT(*) FROM "tenten"."public".solar WHERE orbits = 'sun'

AVG

Returns the average of the column values.

SELECT radius, AVG(AnnualRevenue) FROM "tenten"."public".solar WHERE orbits = 'sun' GROUP BY radius

MIN

Returns the minimum column value.

SELECT MIN(AnnualRevenue), radius FROM "tenten"."public".solar WHERE orbits = 'sun' GROUP BY radius

MAX

Returns the maximum column value.

SELECT radius, MAX(AnnualRevenue) FROM "tenten"."public".solar WHERE orbits = 'sun' GROUP BY radius

SUM

Returns the total sum of the column values.

SELECT SUM(AnnualRevenue) FROM "tenten"."public".solar WHERE orbits = 'sun'

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8509