Home Tutorial Php Sql MySQL Arithmetic

 
 

Share on Google+Share on Google+
MySQL Arithmetic
Posted on: December 9, 2010 at 12:00 AM
Advertisement
This example illustrates how to use arithmetic operator in the MySQL.

MySQL Arithmetic

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  |
+-----+

 

Advertisement

Related Tags for MySQL Arithmetic:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 9, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com