Integer Types of MySQL

Just reading this: http://dev.mysql.com/doc/refman/5.7/en/integer-types.html
So if I use int(11), what this 11 mean? does it mean 11x4 bytes? if yes, how to calculate the maxmimum value of int(11)?

no. the bytes required depend on the integer type alone. the 11 is the number’s display width (https://dev.mysql.com/doc/refman/5.7/en/numeric-type-attributes.html)

I see for timestamp, usually int(11) is used, I see the maxmimum allowable value for mysql int is 4294967295, assuming this as a timestamp, it would be 2106-Feb-07, so should we change the field type to BIGINT on 2106-Feb-08 (if we are still alive! :smile: ) ?

I doubt it - surely the most commonly used data type for a timestamp would be timestamp

At the very least that would prevent needing to change the type when the current field size overflows.

1 Like

Somewhat off-topic

isn’t that due to break ~2038?

just as with Y2K it will certainly be at least mostly fixed by then.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.