What is the difference between CHAR and VARCHAR ?


  1. Used to store character string value of fixed length
  2. The maximum no. of characters the data type can hold is 255 characters.
  3. It's 20% faster than VARCHAR.
  4. Uses static memory allocation.
  5. When CHAR values are stored, they are right-padded with trailing spaces to make up the specified length


  1. Used to store variable length alphanumeric data.
  2. The maximum this data type can hold is up to - Pre-MySQL 5.0.3: 255 characters and  Post-MySQL 5.0.3: 65,535 characters shared for the row.
  3. It's slower than CHAR.
  4. Uses dynamic memory allocation.
  5. VARCHAR values aren’t padded during storage.Trailing spaces are retained when data is inserted into the field.
  6. 1 byte --> when the data value requires less than 255 bytes.
  7. 2 byte --> when the data value requires more than 255 bytes.


find the nth highest salary in mysql without limit
How to find greater than average salary records in MySQL
how to find duplicate records in MySQL query
How to use second index forcefully in MySQL
How to get total number of rows in MySQL table with and without count