Monday, May 27, 2013

CHAR and VARCHAR


http://dev.mysql.com/doc/refman/5.0/en/char.html


The following table illustrates the differences between CHAR and VARCHAR by showing the result of storing various string values into CHAR(4) and VARCHAR(4) columns (assuming that the column uses a single-byte character set such as latin1).
ValueCHAR(4)Storage RequiredVARCHAR(4)Storage Required
'''    '4 bytes''1 byte
'ab''ab  '4 bytes'ab'3 bytes
'abcd''abcd'4 bytes'abcd'5 bytes
'abcdefgh''abcd'4 bytes'abcd'5 bytes
The values shown as stored in the last row of the table apply only when not using strict mode; if 

No comments:

Post a Comment