I realize that tinyint
is a single byte integer (by the way, is it signed or unsigned?). What does the argument (3)
signify? I've searched and couldn't find the answer.
See this blog page about MySQL column type definitions.
For numeric types length modifier is actually display width, which has nothing to do with what can be stored in field. Yes, that’s it – both TINYINT(1) and TINYINT(4) can store values in range -128..127 (or for unsigned values 0..255), and are absolutely identical datatypes, with one small twist (which concerns date retrieval – see below). Here is explanation of what is meant by display width, taken directly from the source:
The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range allowed by three characters are displayed using more than three characters.