Nice job! Before we move on, let's discuss the data types that work with
ROUND() in PostgreSQL:
- The single-argument function
ROUND(x) accepts both numeric and double precision (floating-point number) data types.
- If you want to round a number with precision to a specific decimal place with the two-argument
ROUND(x, precision) function, the number being rounded must be either a numeric or a
To round a floating point number and specify a precision at the same time, you have to first cast it as numeric. For example:
SELECT ROUND(weight::numeric, 2) AS rounded_weight
will round the
weight to two decimal places.