It may vary according to the implementation of each database, but in general it determines the maximum number of characters that can be displayed in the column or the maximum that can be used in the column.
What certainly does not determine is the amount of bytes it will occupy on the line. Texts can have encodings that a character has no direct relation to the number of bytes occupied. The storage of numbers will be done according to the implementation and each one can have a different consumption.
This number that appears is more for data display control than for storage, contrary to popular belief. The size it occupies is implementation detail.
Then a INT(20)
, if this is possible, indicates that the number can have up to 20 digits in its textual representation.
A VARCHAR(8)
indicates that the text can be up to 8 characters long. Some banks allow them to be stored more than this, some will occupy 8 bytes because this type has no encoding multibyte, but it depends on the implementation. You have to look closely at the documentation of each system.
Caution: in the case of Mysql, the value between parentheses in numeric types determines only one length exhibition of the values. Cf. http://everythingmysql.ning.com/profiles/blogs/data-type-confusion-what-is-an
– bfavaretto
@bfavaretto I remember only the Mysql that does this, if you or someone else knows of another, please put here or reply with this detail.
– Maniero