MySQL tutorial: DIV [EN]
top of page
CerebroSQL

MySQL: 

DIV

Syntax:
DIV

Integer division. Discards from the division result any fractional part
to the right of the decimal point.

If either operand has a noninteger type, the operands are converted to
DECIMAL and divided using DECIMAL arithmetic before converting the
result to BIGINT. If the result exceeds BIGINT range, an error occurs.

Example

mysql> SELECT 5 DIV 2, -5 DIV 2, 5 DIV -2, -5 DIV -2;
-> 2, -2, -2, 2

bottom of page