Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Saturday 6 September 2014

ROUND function in Greenplum

ROUND function is used to round the number of decimal places. ROUND function takes two parameters,
one is the number to round and second is the number of decimal it should round to.

You must provide second parameter otherwise it will round the number to 0 decimal.

Syntax is:-

ROUND(NUMERIC_FIELD,[ROUND_NUMBER_TO_DECIMAL]);

Example:-

SELECT ROUND(80.5446,2) ROUND_TO;

--> 80.54

SELECT ROUND(80.50411,2) ROUND_TO;

--> 80.5

Note:- Above it have rounded to number to two decimal but since the 0 is second decimal so it will skip the same.

SELECT ROUND(80.9851,3) ROUND_TO;

--> 80.985

SELECT ROUND(9.8574) ROUND_TO;

--> 9




Read Also:- ROUND function in Teradata

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.