Disclaimer: this post takes into consideration that strict mode is enabled on the server
used to store strings.
VARCHAR stores varying length
CHAR always use the same exact size no matter
the size of the string. For example, CHAR(4) will always
store 4 bytes, whereas VARCHAR(4) will store up to 5
bytes. See documentation.
When we create a table like this one:
We put inside the parentheses the length of the field in
characters for the
VARCHAR field. However, the
maximum size in bytes of the field will depend on the
COLLATION of the table. You
can also specify a different collation for a column.
- latin1: 1 to 2 bytes per …