DIV is a MySQL arithmetic operator that executes integer division between two numeric expressions. Unlike the standard / operator, which returns a precise (possibly fractional) result, DIV always truncates toward zero, yielding an integer. If either operand is NULL, the result is NULL. If the divisor is 0, MySQL returns NULL and raises a warning or error depending on sql_mode (e.g., ERROR_FOR_DIVISION_BY_ZERO). Because DIV is evaluated with the same precedence as * and /, parentheses can clarify more complex expressions. The return type is BIGINT for integer operands and DECIMAL if either operand is DECIMAL.
numerator
(numeric) - dividend in the integer divisiondenominator
(numeric) - divisor in the integer division (must not be 0)MOD, %, / (division), FLOOR, CEIL, ROUND, sql_mode
MySQL 3.23
DIV performs integer division, returning only the whole-number part of the quotient.
It truncates toward zero. For example, 7 DIV 3 returns 2, not 2.33.
MySQL returns NULL and issues a warning or error depending on sql_mode.
No. In those systems you can mimic integer division with expressions like FLOOR(numerator / denominator).