Decimal definition of MySQL

When using a decimal number in MySQL, (5,3)does the value make the maximum number be 99.999? If not, how can I indicate this? My number is for currency, so I need to use a decimal number, but it should not exceed 99 and should have 3 decimal places.

+3
source share
2 answers

decimal (5,3)- The standard SQL method for defining a field with a range -99.999 .. 99.999.

Please note that when using MySQL, if you try to insert a value that is out of range, MySQL automatically trims the value to the nearest boundary value (in this case, 99.999 or -99.999) without causing an error.

Added

5 , 3 . 1.23, 1.230; 1 1.000. 12.3456, 12.346; 12.0001, 12.000.

, , API . , ; (float, double), ; (#/Java), , .

+5

. .

+1

Source: https://habr.com/ru/post/1753460/


All Articles