Should I specify an integer length when creating the id field in MySQL via phpMyAdmin?

I saw that someone did not set the length in the tutorial, but this was specifically for calculating the total number of users and just for automatic increase. I was in the habit of always specifying the length, because I thought it was mandatory, but I wanted to ask if I could leave it blank unless it had a date or pin number, etc., where the length is always given. (I used it as 11 digits or more if I wasnโ€™t sure)

+4
source share
2 answers

Each integer field defaults to 11 when it remains empty, so you can leave it.

+3
source

No, you do not need to specify the length of the integers. I have never done that.

There are different integral data types with different sizes, so you can just choose the one you need.

+2
source

All Articles