1/22/2007

MySQL CHAR and VARCHAR Difference

CHAR and VARCHAR differ in storing and retrieving data values. Both of them use a number (e.g. CHAR(30), VARCHAR(30)) to indicate the length of string that they can hold, but CHAR will use definitely 30 bytes when it stores a string less than 30. VARCHAR will use the actual length of the string, such as 20 bytes (string length) to store (plus 1 byte to store the length, so 21 bytes).

No comments: