Type attributes
As shown earlier, while defining integer columns, we can also specify an optional display width attribute. For example, INT(5) indicates an integer number with a display width of 5 digits. When this column is used in the SELECT query, the output will display the number left padded with spaces. So, if the value stored in the INT(5) column is 123, then it will be displayed as __123. The _ will be a space in the actual output.
However, the display width doesn't limit the range of values which can be stored in the INT(5) column. The question then arises: What if we store a value for which the display width is larger than the display width specified? The display width doesn't prevent values wider than the display width of a column ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access