Revision
So you think you can count
Round and other functions
14. Function round
Revision and practice

Instruction

Good! Now that you know how to subtract and divide, we'll talk about other numerical functions. One of them is round(x). This function will round the number within parentheses to the nearest integer number. This is standard mathematical rounding: any decimal part equal to or greater than 0.5 will be rounded up.

SELECT round(account_balance)
FROM character
WHERE id = 1;

The above query will take the account_balance of the character with id = 1 (the account_balance is 899.34) and round it to the nearest integer (899 in this case).

Exercise

For each character, show its name, its account_balance and its account_balance rounded to the nearest integer. Notice how mathematical rounding is applied.

Console

Code editor

Result

TableConsole