The MOD function returns the remainder left after dividing one numeric expression by another.
Remainder calculations are useful for identifying even and odd values, creating repeating patterns, and assigning records into cycles.
Identify whether an employee ID is even or odd.
SELECT
EmployeeID,
MOD(EmployeeID, 2) AS Remainder
FROM Employees;
MOD is useful in scheduling, batch processing, periodic calculations, record grouping, and data classification.
- MOD returns a division remainder.
- It can identify even and odd numbers.
- It supports repeating patterns.
- It is useful for record grouping.
- Syntax varies between databases.
What does MOD return?
MOD returns the remainder after one number is divided by another.
How can MOD identify even numbers?
If a number divided by 2 has a remainder of zero, the number is even.