DIV
Returns the quotient by dividing the first number by the second one, rounding down to the closest smaller integer. Equivalent to the division operator //
.
See also:
SQL Syntax
func.div(<numerator>, <denominator>)
Analyze Examples
# Equivalent to the division operator "//"
func.div(6.1, 2)
┌───────────────────────────────┐
│ func.div(6.1, 2) │ (6.1 // 2) │
├──────────────────┼────────────┤
│ 3 │ 3 │
└───────────────────────────────┘
# Error when divided by 0
error: APIError: ResponseError with 1006: divided by zero while evaluating function `div(6.1, 0)`
Analyze Syntax
<number1> DIV <number2>
Aliases
SQL Examples
-- Equivalent to the division operator "//"
SELECT 6.1 DIV 2, 6.1//2;
┌──────────────────────────┐
│ (6.1 div 2) │ (6.1 // 2) │
├─────────────┼────────────┤
│ 3 │ 3 │
└──────────────────────────┘
SELECT 6.1 DIV 2, INTDIV(6.1, 2), 6.1 DIV NULL;
┌───────────────────────────────────────────────┐
│ (6.1 div 2) │ intdiv(6.1, 2) │ (6.1 div null) │
├─────────────┼────────────────┼────────────────┤
│ 3 │ 3 │ NULL │
└───────────────────────────────────────────────┘
-- Error when divided by 0
root@localhost:8000/default> SELECT 6.1 DIV 0;
error: APIError: ResponseError with 1006: divided by zero while evaluating function `div(6.1, 0)`
Last modified April 23, 2024 at 12:42 PM EST: updating numerical functions (2a94341)