Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
So you think you can count?
Rounding functions and more
Review and practice
22. Summary



Now let's summarize what we've learned in this section:

We know that:

  • Computations using floating point numbers are not always exact. Use the DECIMAL or MONEY data types for all money columns and whenever precision matters.
  • Dividing two integers is integer division, which is not always accurate. Use CAST(column AS TYPE) to avoid it.
  • Avoid division by zero.

We've also learned some useful functions:

  • The modulo operator (expressed as x % y) returns the remainder of the division of x by y.
  • ROUND(x,p) rounds x up to the nearest whole integer or to the specified number of decimal digits (p).
  • CEILING(x) always rounds up to the nearest integer value.
  • FLOOR(x) always rounds down to the nearest integer value.
  • ABS(x) returns the absolute value of x.
  • SQRT(x) returns the square root of x.

The queries we've written so far have been fairly simple. Let's test your knowledge with some more advanced exercises.


Click Next exercise to continue.