int(10)里面的10是什么意思?

前几天面试,问到这个问题,crud 惯了,从来没深入研究过这些(一直以为是能存储的字节数)。 回来查了一下官方文档:Numeric Type Attributes。 MySQL supports an extension for optionally specifying the display width of integer data types in parentheses following the base keyword for the type. For example, INT(4) specifies an INT with a display width of four digits. This optional display width may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. (That is, this width is present in the metadata returned with result sets....

2022-06-24 · 王二