Tuesday 20 December 2011

SQL - Arithmetic Operators

Here are simple examples showing usage of SQL Arithmetic Operators:
SQL> select 10+ 20;
+--------+
| 10+ 20 |
+--------+
|     30 |
+--------+
1 row in set (0.00 sec)

SQL> select 10 * 20;
+---------+
| 10 * 20 |
+---------+
|     200 |
+---------+
1 row in set (0.00 sec)

SQL> select 10 / 5;
+--------+
| 10 / 5 |
+--------+
| 2.0000 |
+--------+
1 row in set (0.03 sec)

SQL> select 12 %  5;
+---------+
| 12 %  5 |
+---------+
|       2 |
+---------+
1 row in set (0.00 sec)

No comments: