The correct data type for storing negative numbers

I need to keep the value -1. Is the data type correct tinyint(1)or tinyint(2)and why?

I know that I can also store many more numbers with tinyint tinyint (1), but I want to know what you use in my case.

+4
source share
1 answer

You can use DECIMAL , which would probably be the best data type for storing negative numbers.

Standard SQL requires that DECIMAL (5.2) can store any value with five digits and two decimal places, so the values ​​that can be stored in the pay range range from -999.99 to 999.99

TINYINT (1), 1 , -128 127.

:

, TinyInt (1) TinyInt (2)

M . 255. , , 11.2, " ". M - , .

+1

All Articles