abs

description

Syntax

  1. SMALLINT abs(TINYINT x)
  2. INT abs(SMALLINT x)
  3. BIGINT abs(INT x)
  4. LARGEINT abs(BIGINT x)
  5. LARGEINT abs(LARGEINT x)
  6. DOUBLE abs(DOUBLE x)
  7. FLOAT abs(FLOAT x)
  8. DECIMAL abs(DECIMAL x)`

Returns the absolute value of x.

example

  1. mysql> select abs(-2);
  2. +---------+
  3. | abs(-2) |
  4. +---------+
  5. | 2 |
  6. +---------+
  7. mysql> select abs(3.254655654);
  8. +------------------+
  9. | abs(3.254655654) |
  10. +------------------+
  11. | 3.254655654 |
  12. +------------------+
  13. mysql> select abs(-3254654236547654354654767);
  14. +---------------------------------+
  15. | abs(-3254654236547654354654767) |
  16. +---------------------------------+
  17. | 3254654236547654354654767 |
  18. +---------------------------------+

keywords

  1. ABS