Division
Returns the quotient of two numeric operands.
Category: binary
SQL symbol: /
Syntax
sql
<dividend> / <divisor>Parameters
<dividend>— The value to divide. Two integers still divide to a FLOAT - useDIVfor integer division. Acceptsdecimal,float,integer.<divisor>— The value to divide by. Dividing by zero yields infinity rather than raising, because the result is floating point. Acceptsdecimal,float,integer.
Returns
Examples
sql
SELECT 5 / 2;2.5
sql
SELECT CAST(1 AS DECIMAL(10,2)) / 3;0.33333333
Signatures
decimal / decimal→ decimaldecimal / float→ floatdecimal / integer→ decimalfloat / decimal→ floatfloat / float→ floatfloat / integer→ floatinteger / decimal→ decimalinteger / float→ floatinteger / integer→ float
Notes
/ is true division: 5 / 2 is 2.5, never 2. A DECIMAL operand keeps the result DECIMAL; every other combination gives FLOAT, and 1 / 0 is therefore inf rather than an error.