Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
So you think you can count
Round and other functions
Revision and practice
23. Summary


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 a integer division. Use CAST(column AS TYPE) to avoid it.
  • Avoid division by zero. For now ...

We've also learned some useful functions:

  • mod(x,y) or x%y – it returns the reminder of division of x by y
  • round (x) or round(x,p) – rounds up the number to the integer or to specified precision (p)
  • ceil(x) – rounds up to a nearest integer value
  • floor(x) – rounds down to a nearest integer value
  • trunc(x) or trunc(x,p) – always round towards zero to interger value or to specified precision (p)
  • abs(x) – returns a absolute value of x
  • sqrt(x) – returns a square root of x

The queries we've written so far were fairly simple. Let's test your knowledge with more advanced examples.


Press Next exercise to continue.