DIV
Example
Section titled “Example”SELECT 10 DIV 3;Output
Section titled “Output”3Explanation
Section titled “Explanation”The DIV operator in MySQL performs integer division. The above SELECT statement returns the quotient of 10 divided by 3, which is 3 as it gives the result as integer.
Example
Section titled “Example”SELECT 15 DIV 2;Output
Section titled “Output”7Explanation
Section titled “Explanation”The “DIV” operator in SQL performs an integer division, i.e., it will return only the integer part of the division. For instance, in the above code “15 DIV 2” gives an output “7” discarding the decimal part.
Example
Section titled “Example”SELECT 10 DIV 3 FROM dual;Output
Section titled “Output”3Explanation
Section titled “Explanation”The DIV operation in Oracle performs integer division, where the output is the largest integer value that is less than or equal to the exact quotient. In this case, 10 divided by 3 equals to 3.33. The largest integer value less than or equal to 3.33 is 3, therefore the output of the DIV operation is 3.