# SQL - Decimal(p,s) or Numeric(p,s)

DECIMAL and NUMERIC are sql datatype used to represent a fixed point notation (exact number)

numeric is generally functionally identical to decimal.

## Syntax

NUMERIC(p, s)
DECIMAL(p, s)


where:

• p is the precision (the total number of significant digits)
• f is scale (the number of digits at the right side of the point)

## Example

• The number 00123456.780 has a precision of 8 and a scale of 2

## Numeric vs Decimal

The Sql standard defined NUMERIC and DECIMAL in the following words:

• NUMERIC specifies the data type exact numeric, with the decimal precision and scale specified by the <precision> and <scale>.
• DECIMAL specifies the data type exact numeric, with the decimal scale specified by the <scale> and the implementation-defined decimal precision equal to or greater than the value of the specified <precision>.

## Storage and range

Maximum storage sizes vary, based on the precision.

Precision Storage bytes
1 - 9 5
10-19 9
20-28 13
29-38 17

For a precision of 38, the range of value is $-10^38 +1$ through $10^38$