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
Review 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 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) or x%y – returns the remainder of division of x by y.
  • round(x) or round(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) or trunc(x,p) – always round towards zero to an interger value or to a specified precision (p).
  • abs(x) – returns the absolute value of x.
  • sqrt(x) – returns the square root of x.

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


Click Next exercise to continue.