Home > Mobile >  Difference between Numeric and Decimal in SQL
Difference between Numeric and Decimal in SQL

Time:06-28

What's the difference between numeric[(p[,s])] and decimal[(p[,s])] as SQL datatype?

CodePudding user response:

The NUMERIC data type is strict; it enforces the exact precision and scale that you have specified. This is in stark contrast to DECIMAL, which allows more numbers than the stated precision.

CodePudding user response:

NUMERIC(p, s) takes two arguments: precision (p) and scale (s). Numeric datatype enforces the exact precision and scale that you have specified.

On other side, DECIMAL(p, s) also takes the same two arguments. However, with the DECIMAL data type, the precision can be greater than the value you have supplied. Thus, this data type can provide you with more flexibility.

  • Related