DIV() Function in MySQL
Last Updated :
10 Dec, 2020
Improve
DIV() function :
This function in MySQL is used to return a quotient (integer) value when integer division is done. For example, when 7 is divided by 3, then 2 will be returned.
Syntax :
SELECT x DIV y;Parameter : This method accepts two parameters as given below as follows.
- x - Specified dividend which will be divided by y.
- y - Specified divisor which will divide x.
SELECT 7 DIV 3;Output :
2Example-2 : Getting quotient 1 when 4 is divided by 4.
SELECT 4 DIV 4;Output :
1Example-3 : Getting quotient 0 when 2 is divided by 4. Here dividend is less than divisor that is why 0 is returned.
SELECT 2 DIV 4;Output :
0Application : This function is used to return a quotient (integer) value when integer division is done.