mod
function
Applies to: Databricks SQL
Databricks Runtime
Returns the remainder after dividend / divisor
. This function is equivalent to the % (percent sign) operator.
Syntax
mod(dividend, divisor)
Arguments
dividend
: An expression that evaluates to a numeric.divisor
: An expression that evaluates to a numeric.
Returns
If both dividend
and divisor
are of DECIMAL
, the result matches the divisor’s type.
In all other cases, a DOUBLE.
If divisor
is 0, the function raises a DIVIDE_BY_ZERO error.
Examples
> SELECT MOD(2, 1.8);
0.2
> SELECT MOD(2, 0);
Error: DIVIDE_BY_ZERO
Related functions
Tilbakemeldinger
https://aka.ms/ContentUserFeedback.
Kommer snart: Gjennom 2024 faser vi ut GitHub Issues som tilbakemeldingsmekanisme for innhold, og erstatter det med et nytt system for tilbakemeldinger. Hvis du vil ha mer informasjon, kan du se:Send inn og vis tilbakemelding for