So you think you can count
Round and other functions
21. Function abs
Revision and practice


Nice! Of course, SQL features numerical functions other than rounding, too. Let's take a look at two of them.

The first one is abs(x) and it returns the absolute value of x. Positive numbers will be expressed as they are, but negative ones will be expressed without the minus at the beginning.

SELECT abs(3), abs(-3);

The above query will return 3 twice. The absolute value of 3 is 3, just like the absolute value of -3.

Let's give it a try.


For each character, show its stat_modifier and its absolute value.

Stuck? Here's a hint!

Use abs(stat_modifier).


Code editor