Operators Operator

//

Use the // operator for integer division. With integer operands, the fractional part is discarded rather than returned as a decimal.

Reference: Haybarn WASM 2.0.0-rc12

Operands & returns

12 overloads

left // right

Operator
Overload link leftright Returns
#01 BIGINTBIGINT BIGINT
#02 DOUBLEDOUBLE DOUBLE
#03 FLOATFLOAT FLOAT
#04 HUGEINTHUGEINT HUGEINT
#05 INTEGERINTEGER INTEGER
#06 SMALLINTSMALLINT SMALLINT
#07 TINYINTTINYINT TINYINT
#08 UBIGINTUBIGINT UBIGINT
#09 UHUGEINTUHUGEINT UHUGEINT
#10 UINTEGERUINTEGER UINTEGER
#11 USMALLINTUSMALLINT USMALLINT
#12 UTINYINTUTINYINT UTINYINT

Divide integers without a fractional result

Use the // operator for integer division. With integer operands, the fractional part is discarded rather than returned as a decimal.

For integer operands, truncation is toward zero. A NULL operand yields NULL.

Divide integers without a fractional result
SQL
Haybarn WASM 2.0.0-rc12 ยท In your browser

Guide example ยท Run to view results.

Expected result
quotientnegative_quotientmissing
3-3NULL

Watch for: The / operator performs floating point division on integer inputs. Choose // only when discarding the remainder is intended.