Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Review
So you think you can count?
Rounding functions and more
16. Numeric functions: ROUND()
Review and practice

## Instruction

Good! Now that you know how to subtract and divide in T-SQL, we'll talk about some other numeric functions. One of them is ROUND(), which looks like this:

ROUND(value, precision)

This function will round the number (the first parameter) to the nearest numeric value, using the precision specified by the second parameter. Its default is standard mathematical rounding: anything equal to or greater than 0.5 will be rounded up to the next whole number.

Let's look at ROUND() in action:

SELECT
ROUND(AccountBalance, 0) AS Round
FROM Character
WHERE Id = 1;


The above query will take the AccountBalance of the character with Id = 1 (the AccountBalance is 899.34) and round it to the nearest integer (899.00). Remember that ROUND() won't change the type of the value returned.

## Exercise

For each character, show its Name, its actual AccountBalance, and its AccountBalance rounded to the nearest integer. Name the column IntegerBalance. Notice how mathematical rounding is applied. 