ID EN
Arithmetic Operators

DIV

MySQL 8.4 🇮🇩 Bahasa Indonesia

Pembagian bilangan bulat. Buang bagian pecahan apa pun di sebelah kanan koma desimal dari hasil pembagian.

Syntax

MYSQL
SELECT 5 DIV 2, -5 DIV 2, 5 DIV -2, -5 DIV -2;
2, -2, -2, 2

Contoh

Example

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