SELECT
AVG(DISTINCT my_smallint_column) AS type_smallint,
AVG(ALL my_integer_column) AS type_integer,
AVG(my_bigint_column) AS type_bigint,
AVG(my_numeric_column) AS type_numeric,
AVG(my_decimal_column) AS type_decimal,
AVG(my_real_column) AS type_real,
AVG(my_double_precision_column) AS type_double_precision,
AVG(my_super_column) AS type_super
FROM example_table;
type_smallint
type_integer
type_bigint
type_numeric
type_decimal
type_real
type_double_precision
type_super
3
300
30000000000
345
676
2.2080000400543214
2.40674
46779
Output Code:
OUT -> Redshift_01.sql
SELECT
AVG(DISTINCT my_smallint_column) AS type_smallint,
AVG(ALL my_integer_column) AS type_integer,
AVG(my_bigint_column) AS type_bigint,
AVG(my_numeric_column) AS type_numeric,
AVG(my_decimal_column) AS type_decimal,
AVG(my_real_column) AS type_real,
AVG(my_double_precision_column) AS type_double_precision,
AVG(my_super_column) AS type_super
FROM example_table;
type_smallint
type_integer
type_bigint
type_numeric
type_decimal
type_real
type_double_precision
type_super
3.000000
300.000000
30000000000.000000
345.800000
676.400000
2.208
2.40674
46779
Note
AVG, depending on the data type, can behave differently in terms of rounding and formatting, which may result in different precision or decimal places when comparing Redshift with Snowflake.