Modulo in SQL

Level 114 keystrokes

The percent (%) operator returns the remainder of division.

SQL code

-- % returns the remainder of a division (modulo)
-- 17 = 5 × 3 + 2, so this returns 2
1SELECT 17 % 5;

Output

+---------+
| 17 % 5  |
+---------+
|       2 |
+---------+
1 row in set
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this SQL code and how often they appear.

  • ;× 1
  • %× 1

More SQL examples at level 1

← SQL typing practice