Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Mod Function In Sql in SQL

Mod Function In Sql in SQL

? MOD() Function in SQL

The MOD() function returns the remainder of a division between two numbers (also called the modulus operation).


? Syntax:

MOD(dividend, divisor)
  • dividend: The number to be divided.

  • divisor: The number by which you divide.


? Example:

SELECT MOD(17, 5) AS remainder;

Result:

remainder
2

Because 17 divided by 5 is 3 with a remainder of 2.


? Notes:

  • Equivalent function in some databases:

    • MOD() — MySQL, Oracle, PostgreSQL

    • % operator — SQL Server (SELECT 17 % 5)

  • Useful for checking even/odd numbers (MOD(number, 2)).


Let me know if you want examples with MOD() in different SQL dialects!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql