AVG

Computes the average (arithmetic mean) of all input values.

Syntax

AVG(X)

Arguments

X

Type: numeric

The values to be averaged.

Returns

Type: double

Returns the average of all input values.


Examples

Transformation job example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        LOWER(ordertype) as ordertype,
        ROUND(AVG(nettotal), 2) as avgtotal
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE $commit_time BETWEEN run_start_time() - PARSE_DURATION('1d') 
    AND run_end_time()
    GROUP BY 1
    LIMIT 2;

Query result

ordertypeavgtotal

pickup

1062.14

shipping

1061.91

Last updated