top of page
89
MySQL 8.0
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.
mysql> SELECT 5 DIV 2, -5 DIV 2, 5 DIV -2, -5 DIV -2;
-> 2, -2, -2, 2