BigQuery

Fungsi SQL BigQuery

Data warehouse serverless dari Google Cloud. 28 fungsi tersedia.

Menampilkan 24 dari 28 fungsi dalam kategori Aggregate

ANY_VALUE

Aggregate

Returns one value from a group non-deterministically. Useful for retrieving a value from a column that is not being aggregated when all values in the group are the same.

Tipe hasil: Same as input type

APPROX_COUNT_DISTINCT

Aggregate

Estimates the number of distinct values using the HyperLogLog++ algorithm. Much faster and less resource-intensive than COUNT(DISTINCT) for large datasets.

Tipe hasil: INT64

APPROX_QUANTILES

Aggregate

Calculates approximate quantile boundaries from numeric data. Uses an efficient approximate algorithm for large datasets, returning an array with n+1 elements.

Tipe hasil: ARRAY<T>

APPROX_TOP_COUNT

Aggregate

Returns the approximate most frequently occurring elements along with their counts. Uses a highly efficient approximate algorithm for large datasets.

Tipe hasil: ARRAY<STRUCT<value T, count INT64>>

APPROX_TOP_SUM

Aggregate

Returns the approximate elements with the highest total weight. Similar to APPROX_TOP_COUNT but ranked by sum of weights rather than count.

Tipe hasil: ARRAY<STRUCT<value T, sum INT64>>

ARRAY_AGG

Aggregate

Collects values from multiple rows into an ARRAY. A powerful BigQuery function for building nested data structures.

Tipe hasil: ARRAY<T>

ARRAY_CONCAT_AGG

Aggregate

Concatenates multiple arrays into a single array. Useful when each row already contains an array and you want to merge them all into one.

Tipe hasil: ARRAY<T>

AVG

Aggregate

Calculates the average (mean) of numeric values in a column. Ignores NULL values and supports multiple numeric types in BigQuery.

Tipe hasil: FLOAT64

BIT_AND

Aggregate

Performs a bitwise AND operation across all values in a group. Returns a value where each bit is 1 only if all input values have that bit set to 1.

Tipe hasil: INT64

BIT_OR

Aggregate

Performs a bitwise OR operation across all values in a group. Returns a value where each bit is 1 if at least one input value has that bit set to 1.

Tipe hasil: INT64

BIT_XOR

Aggregate

Performs a bitwise XOR operation across all values in a group. Returns a value where each bit is 1 if the number of input values with that bit set to 1 is odd.

Tipe hasil: INT64

CORR

Aggregate

Menghitung koefisien korelasi Pearson antara dua kolom numerik.

Tipe hasil: FLOAT64

COUNT

Aggregate

Counts the number of rows or non-NULL values in a column. A fundamental aggregate function in BigQuery for large-scale data analysis.

Tipe hasil: INT64

COUNTIF

Aggregate

Counts the number of rows that satisfy a given condition. Provides a more concise and readable syntax compared to COUNT with CASE or IF.

Tipe hasil: INT64

COVAR_POP

Aggregate

Menghitung kovarians populasi antara dua kolom numerik.

Tipe hasil: FLOAT64

COVAR_SAMP

Aggregate

Menghitung kovarians sample antara dua kolom numerik.

Tipe hasil: FLOAT64

LOGICAL_AND

Aggregate

Returns TRUE if ALL values in the group are TRUE. Acts as an aggregated AND operator, useful for verifying that every condition in a set is met.

Tipe hasil: BOOL

LOGICAL_OR

Aggregate

Returns TRUE if AT LEAST ONE value in the group is TRUE. Acts as an aggregated OR operator, useful for checking whether any condition in a set is met.

Tipe hasil: BOOL

MAX

Aggregate

Returns the maximum value from a column or expression. Supports numeric, string, date/time, and boolean types in BigQuery.

Tipe hasil: Same as input type

MIN

Aggregate

Returns the minimum value from a column or expression. Supports numeric, string, date/time, and boolean types in BigQuery.

Tipe hasil: Same as input type

STDDEV

Aggregate

Calculates the sample standard deviation of numeric values. Measures how spread out the data is from its mean. An alias for STDDEV_SAMP.

Tipe hasil: FLOAT64

STDDEV_POP

Aggregate

Calculates the population standard deviation of numeric values. Uses the N divisor formula (not N-1), suitable when the data represents an entire population.

Tipe hasil: FLOAT64

STDDEV_SAMP

Aggregate

Calculates the sample standard deviation of numeric values. Uses the N-1 divisor formula (Bessel's correction), suitable for sample data that represents a larger population.

Tipe hasil: FLOAT64

STRING_AGG

Aggregate

Concatenates string values from multiple rows into a single string with a specified delimiter. Very useful for creating lists or comma-separated values in BigQuery.

Tipe hasil: STRING