/¶
Operator Description¶
The / operator is used for division operations.
Grammar Structure¶
SQL
SELECT value1/value2;
SQL
SELECT column1/column2... FROM table_name;
The division operation cannot be divided by O.
Example¶
Text
mysql> select 1123.2333/1233.3331;
+-----------------------+
| 1123.2333 / 1233.3331 |
+-----------------------+
| 0.9107298750 |
+-----------------------+
1 row in set (0.00 sec)
Text
create table t2(c1 int, c2 int);
insert into t2 values (-3, 2);
insert into t2 values (1, 2);
mysql> select c1/2 from t2;
+--------+
| c1 / 2 |
+--------+
| -1.5 |
| 0.5 |
+--------+
2 rows in set (0.00 sec)
mysql> select c1/c2 from t2;
+---------+
| c1 / c2 |
+---------+
| -1.5 |
| 0.5 |
+---------+
2 rows in set (0.01 sec)
Last updated on