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

Data System Architecture


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

numeric is generally functionally identical to decimal.


With a DECIMAL(5,2):

  • the number has:
    • a precision of 5
    • and a scale of 2
  • you would be able to store any value with:
  • values can be stored in the range from -999.99 to 999.99.

The number 00123456.780 has:

  • a precision of 8 (ie 12345678)
  • and a scale of 2 (ie 78)




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 <math>-10^{38 +1} </math> through <math>10^{38}</math>

Discover More
Data System Architecture
Computer - Fixed Point

fixed point number in computer are generally called: NUMERIC or DECIMAL
Data System Architecture
Number - Floating-point (system|notation) - (Float|Double) - Approximate numeric

The term floating point refers to the fact that the number's radix point can float, that is, it can be placed anywhere relative to the significant digits of the number. They are fractional numbers...
Data System Architecture
SQL - Data Type

The Data Type of a column in SQL. They are defined in the ANSI/ISO SQL standard but may vary from sql engine (database) to another. The below table shows you the history of the data type in the ANSI...
Data System Architecture
SQL - Timestamp Data Type

This page is the in Sql datatype. A TIMESTAMP contains the following s: YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND. If is not specified,...

Share this page:
Follow us:
Task Runner