• What does “size” in int(size) of MySQL mean? Well, Nothing if you are not using ZEROFILL !

    I was always wondering what the size of numeric columns in MySQL was. Forgive me if this is obvious to someone else. But for me the MySQL manual lacks a great deal in this field. TL;DR: It’s about the display width. You only see it when you use ZEROFILL. Usually you see something like int(11) in CREATE TABLE statements, but you can also change it to int(4). So what does this size mean? Can you store higher values in a int(11) than in an int(4)? Let’s see what the MySQL manual says:

    INT[(M)] [UNSIGNED] [ZEROFILL] A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295. No word about the M. The entry about BOOL suggests that the size is not there for fun as it is a synonym for TINYINT(1) (with the specific size of 1).

    TINYINT[(M)] (...)