MOD Function - SQL
Overview
The MOD function in SQL returns the remainder of a division operation between two numbers. It is useful for finding the remainder after division.
Example:
SELECT
MOD(10, 3)
Syntax:
SELECT
MOD(numerator, denominator)
numerator
is the number to be divided.
denominator
is the number by which to divide the numerator.
Example: Hard-coded value
In this example, we are returning the remainder of 10 divided by 3. 3 goes into 10 three times, leaving 1 as the final output.