Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Function management
3. CREATE OR REPLACE FUNCTION – practice

Instruction

Good job! It's your turn to use the CREATE OR REPLACE FUNCTION command. Recall the get_circumference() function we wrote in Part 1:

CREATE FUNCTION get_circumference(diameter decimal)
RETURNS decimal AS $$
BEGIN
  RETURN get_pi() * diameter;
END;
$$ LANGUAGE PLpgSQL;

We'd like this function to return the circumference rounded to two decimal places.

Exercise

Replace the existing get_circumference() function with the new implementation that rounds its result to two decimal places.

Use the round() function.