Instruction
Amazing! OK, let's summarize what we've learned today. We know the following principles:
- Computations in floating point numbers are not always exact. Use decimal numbers for all money columns and when precision matters.
- Dividing two integers is an integer division. Use
CAST(column AS type)to avoid errors. - Avoid division by zero. For now ...
We've also learned some useful functions:
mod(x,y)orx%y– returns the remainder of division ofxbyy.round(x)orround(x,p)– rounds the number to an integer or to a specified precision (p).ceil(x)– rounds up to the nearest integer value.floor(x)– rounds down to the nearest integer value.trunc(x)ortrunc(x,p)– always round towards zero to an interger value or to a specified precision (p).abs(x)– returns the absolute value ofx.sqrt(x)– returns the square root ofx.
The queries we've written so far were fairly simple. Let's test your knowledge with more advanced examples.
Exercise
Click to continue.



