Absolute Value in SQL

Level 116 keystrokes

ABS function returns the absolute value of a number.

SQL code

-- ABS returns the absolute value (the distance from zero)
-- -15 becomes 15; positive numbers stay unchanged
1SELECT ABS(-15);

Output

+----------+
| ABS(-15) |
+----------+
|       15 |
+----------+
1 row in set
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this SQL code and how often they appear.

  • -× 1
  • ;× 1
  • (× 1
  • )× 1

More SQL examples at level 1

← SQL typing practice