SQL - Arithmetic Operators


Advertisements


Here are a few simple examples showing the usage of SQL Arithmetic Operators −

Example 1

SQL> select 10+ 20;

Output

+--------+
| 10+ 20 |
+--------+
|     30 |
+--------+
1 row in set (0.00 sec)

Example 2

SQL> select 10 * 20;

Output

+---------+
| 10 * 20 |
+---------+
|     200 |
+---------+
1 row in set (0.00 sec)

Example 3

SQL> select 10 / 5;

Output

+--------+
| 10 / 5 |
+--------+
| 2.0000 |
+--------+
1 row in set (0.03 sec)

Example 4

SQL> select 12 %  5;

Output

+---------+
| 12 %  5 |
+---------+
|       2 |
+---------+
1 row in set (0.00 sec)

sql-operators.htm

Advertisements