Cmdlets for YouTube Analytics

Build 21.0.7930

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 Groups WHERE Id = 'S'

COUNT(DISTINCT)

Returns the number of distinct, non-null field values matching the query criteria.

SELECT COUNT(DISTINCT Snippet_Title) AS DistinctValues FROM Groups WHERE Id = 'S'

COUNT

Returns the number of rows matching the query criteria.

SELECT COUNT(*) FROM Groups WHERE Id = 'S'

COUNT(DISTINCT)

Returns the number of distinct, non-null field values matching the query criteria.

SELECT COUNT(DISTINCT Snippet_Title) AS DistinctValues FROM Groups WHERE Id = 'S'

AVG

Returns the average of the column values.

SELECT ContentDetails_ItemType, AVG(Additive_Tax) FROM Groups WHERE Id = 'S'  GROUP BY ContentDetails_ItemType

MIN

Returns the minimum column value.

SELECT MIN(Additive_Tax), ContentDetails_ItemType FROM Groups WHERE Id = 'S' GROUP BY ContentDetails_ItemType

MAX

Returns the maximum column value.

SELECT ContentDetails_ItemType, MAX(Additive_Tax) FROM Groups WHERE Id = 'S' GROUP BY ContentDetails_ItemType

SUM

Returns the total sum of the column values.

SELECT SUM(Additive_Tax) FROM Groups WHERE Id = 'S'

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7930