Answer the question
In order to leave comments, you need to log in
Should I put unsigned for fields in MySQL?
Good day! Interested in this question. I watch a lot of tutorials and always use for the id field which will be used as the primary key int(11). I think that this is not correct, since I know that id cannot be negative and it makes sense to do int(10) unsigned, here is the information that I read on the spravkaweb.ru website, it clearly says that "Counting the sequence of numbers for AUTO_INCREMENT starts from 1. This can only be positive numbers. (but even that site uses int(11)). I understand that there may be more than two billion indexes in few places, but I still stick to unsigned. Tell me experts why they do this? Maybe I don't understand. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
At first, you watch what lessons are not clear, and then you are surprised.
Use the UNSIGNED attribute if possible to allow a greater range.© https://dev.mysql.com/doc/refman/5.7/en/example-au...
1. Not all bases can unsigned.
2. The primary key can be negative, why not, you can add it by hand.
3. unsigned can cause problems with a programming language that does not have unsigned types and the same size as int.
4. And most importantly - don't care
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question