For the complete documentation index, see llms.txt. This page is also available as Markdown.

Modulo Operator (%)

Return the remainder of one number divided by another. N % M is the same as MOD(N,M) and N MOD M.

Syntax

N % M

Description

Modulo operator. Returns the remainder of N divided by M. See also MOD.

Examples

SELECT 1042 % 50;
+-----------+
| 1042 % 50 |
+-----------+
|        42 |
+-----------+

The operands can be decimals:

SELECT 0.5 % 0.33;
+------------+
| 0.5 % 0.33 |
+------------+
|       0.17 |
+------------+

See Also

This page is licensed: GPLv2, originally from fill_help_tables.sql

spinner

Last updated

Was this helpful?