New Options when using Round in BigQuery
More Options when using Round Function in BigQuery SQL
A quite popular function in the area of math functions in BigQuery is the ROUND()
function. Here, Google has now provided some new options. This is maybe also an interesting article when working with BigQuery and mathematical functions.
Firstly, a short recap of what the ROUND()
function does and how you can use it. Rounding is done by making the digit at the first omitted decimal place a 0, 1, 2, 3 or 4, then rounding down. If the digit at the first omitted decimal place is a 5, 6, 7, 8 or 9, then it is rounded up.
With the following simple SQL syntax, you can round for example the value 2.8:
SELECT ROUND(2.8)
With the new update Google BigQuery now supports the rounding mode ROUND_HALF_EVEN
for parameterized NUMERIC
or BIGNUMERIC
columns. The ROUND()
function also accepts the rounding mode as an optional argument [1].