| 
	
 | 
 Posted by J.O. Aho on 06/14/75 11:50 
strawberry wrote: 
> With regards the VARCHAR(1) fields listed above, is there any advantage 
> (in terms of performance) of CHAR(1) over VARCHAR(1)? Would anyone do 
> it differently - other than normalizing it of course? 
>  
 
 From the MySQL online manual: 
 
The length of a CHAR column is fixed to the length that you declare when you  
create the table. The length can be any value from 0 to 255. When CHAR  values  
are stored, they are right-padded with spaces to the specified length. When  
CHAR values are retrieved, trailing spaces are removed. 
 
 
So CHAR(50) will always be 50 characters long, while a VARCHAR(50) will be as  
long as the string stored, to a max of 50 characters. There are more  
differences, for more info you can check  
http://dev.mysql.com/doc/refman/5.0/en/char.html 
 
 
  //Aho
 
  
Navigation:
[Reply to this message] 
 |