what is the use of decimal and numeric datatype in postgreSQL. As per the reference the following is the explanation given to these datatypes.

decimal,numeric --> It is a user specified precision, exact and range up to 131072 digits before the decimal point and up to 16383 digits after the decimal point.

The above statement shows the description of decimal and numeric datatype. But, still I didn't understand what is the exact use of these data type and where it is used instead of other datatypes.

Answer with example is much appreciated...


From the documentation

The types decimal and numeric are equivalent. Both types are part of the SQL standard.

float, real, ... and the rest of the floating point types are inexact. This happens in all programming languages. As you have a type like BigDecimal in Java to represent exact numbers, in PostgreSQL you have decimal and numeric.

They are commonly used to represent currency.

Not the answer you're looking for? Browse other questions tagged or ask your own question.