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


Amazing! Now let's summarize what we've learned in this part:

  • Computations using floating point numbers are not always exact. Use the decimal, numeric, 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) or the :: operator to avoid it.
  • Avoid division by zero.

We've learned some useful functions:

  • The modulo operation (x % y) returns the remainder of x by y division.
  • ROUND(x, p) rounds x to the nearest integer or to the specified number of decimal digits (p).
  • CEILING(x) rounds up to the nearest integer value.
  • FLOOR(x) rounds down to the nearest integer value.
  • ABS(x) returns the absolute value of x.
  • TRUNC(x, p) – removes decimal digits given in p from the number x; TRUNC(x) removes all decimal digits.
  • The :: operator and the CAST() function convert data types.

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.