title: What is difference between char and varchar
body: <pre><code>CREATE TABLE IF NOT EXISTS `test` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `country` varchar(5) NOT NULL,
    `state` char(5) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  </code></pre>
  
  <p>I tried following query to insert data</p>
  
  <pre><code>INSERT INTO `test`.`test` (`id` ,`country` ,`state`)
  VALUES (NULL , 'south-india', 'Gujarat');
  </code></pre>
  
  <p>When I execute above query It will shows following warning</p>
  
  <pre><code>Warning: #1265 Data truncated for column 'country' at row 1
  Warning: #1265 Data truncated for column 'state' at row 1
  </code></pre>
  
  <p>I found <a href="https://stackoverflow.com/questions/1885630/whats-the-difference-between-varchar-and-char"><strong>Reference</strong></a> that VARCHAR is variable-length.CHAR is fixed length.</p>
  
  <p>Then what you mean by </p>
  
  <p><strong>VARCHAR is variable-length.</strong></p>
  
  <p><strong>CHAR is fixed length.</strong></p>