Open In App

DIV() Function in MySQL

Last Updated : 10 Dec, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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.
Returns : It returns a quotient (integer) value when integer division is done. Example-1 : Getting quotient 2 when 7 is divided by 3.
SELECT 7 DIV 3;
Output :
2
Example-2 : Getting quotient 1 when 4 is divided by 4.
SELECT 4 DIV 4;
Output :
1
Example-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 :
0
Application : This function is used to return a quotient (integer) value when integer division is done.

Next Article
Article Tags :

Similar Reads