1
I was setting up a bank for a personal project and I came across creating a table to keep a few values, this would use a TINYINT
as a primary key, since I assume I won’t go more than 100 records, but if I do, I want to have a ceiling greater than 127.
(the above example is hypothetical, serving only to explain the question. I am already using INT(2)
).
So I’d like to know, considering the key values start at 0, use the UNSIGNED
in the primary key allows me to register more values? Since the negative values are used in the positive ones?
(Sure I can register using negative keys and it would be useful to keep without the UNSIGNED
in that case, but it’s not something I’ll use).
Edit after title change: When I changed the title ("is it really necessary?") "lost" part of the question, another part would be: It is common/necessary to always use?
Reviewing 4 years later, this is an example of why Accept should not define ordering of responses, precisely because it is a common answer wrong stay above the correct ones, as happened here - after all, the Accept is given by those who are just in doubt. And worse, with positive votes. For those who did not understand, e.g. from -10 to 10 have the same amount of possibilities as 0 to 20. The unsigned does not change it. It facilitates self-numbering, but nothing prevents make Insert using the negatives using the whole range.
– Bacco