+

Description

The + operator is used for addition.

Syntax

  1. > SELECT value1+value2;
  1. > SELECT column1+column2... FROM table_name;

Examples

  1. mysql> select 1123.2333+1233.3331;
  2. +-----------------------+
  3. | 1123.2333 + 1233.3331 |
  4. +-----------------------+
  5. | 2356.5664 |
  6. +-----------------------+
  7. 1 row in set (0.01 sec)
  1. create table t2(c1 int, c2 int);
  2. insert into t2 values (-3, 2);
  3. insert into t2 values (1, 2);
  4. mysql> select c1+5 from t2;
  5. +--------+
  6. | c1 + 5 |
  7. +--------+
  8. | 2 |
  9. | 6 |
  10. +--------+
  11. 2 rows in set (0.00 sec)
  12. mysql> select c1+c2 from t2;
  13. +---------+
  14. | c1 + c2 |
  15. +---------+
  16. | -1 |
  17. | 3 |
  18. +---------+
  19. 2 rows in set (0.00 sec)