This example illustrates how to use arithmetic operator in the MySQL.
In this example we use arithmetic operator (+, /, -, *, %).
Query
|
Output
|
select 3+5;
|
+-----+ | 3+5 | +-----+ | 8 | +-----+
|
select 5/3;
|
+--------+ | 5/3 | +--------+ | 1.6667 | +--------+
|
select 3-5;
|
+-----+ | 3-5 | +-----+ | -2 | +-----+
|
select 3%5;
|
+-----+ | 3%5 | +-----+ | 3 | +-----+
|
select 20%5;
|
+------+ | 20%5 | +------+ | 0 | +------+
|
select 3*5;
|
+-----+ | 3*5 | +-----+ | 15 | +-----+
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.