Summer Deals - 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
17. Round in Postgres – explanation
Review and practice

Instruction

In Postgres, 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(CAST(weight AS numeric), 2) AS rounded_weight
FROM character;

will round the weight to two decimal places.

Exercise

Round height to two decimal places. Name the column rounded_height.

Stuck? Here's a hint!

Here, you'll need round(CAST(height AS numeric), 2).