Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Reviewing SQL and numbers
So you think you can count
Round and other functions
18. Other rounding functions
Review and practice

## Instruction

That was correct again. There are also other rounding functions available in each database.

• ceil(x) (in SQL Serverceiling()) returns the smallest integer which is not less than x. In other words, it always rounds up (13.7 will become 14, and so will 13.1).
• floor(x) is the opposite of ceil(x) – it always rounds down, so 13.7 will become 13.
• trunc(x) (in MySQLtruncate()) is yet another function which always rounds towards 0. For positive numbers, it works like floor(x) (13.7 becomes 13). For negative ones, it works like ceil(x) (-13.7 becomes -13).

What's more, each of the functions above can be used with a second argument to specify its precision, as in the case of round(x, precision). When using the round(x, precision) function with two arguments, PostgreSQL requires us to pass the first argument of the numeric type. Use casting when appropriate.

## Exercise

Let's check some rounding functions in the next few exercises. Show the character's name together with its weight, followed by the weight rounded up (name this column weight_rounded_up.

### Stuck? Here's a hint!

Use ceil(weight). 