What is the difference between char and varchar in sql???
i would like to explain you with an analogy of varchar with polythene bag and char with wooden box. Now if you have some item to store in a Box the volume occupied by the box will be constant. But if we take polythene bag we could wrap the content to the same volume of the item so as to reduce the space required to keep the polythene bag. Now I guess u might have got some clue . Varchar has a certain limit (same with polythene bag i.e it can keep a certain volume of item in it) but Varchar helps us to reduce the memory requirement to avoid memory wastage but in case of char i.e the wooden box it would occpy the whole area even if we want to keep a needle in it. i.e it cannot wrap its length to the variable's length.
http://stackoverflow.com/questions/3887735/mysql-difference-between-char-and-varchar from the page above: "VARCHAR stores a variable number of bytes for only the space required by the content. CHAR stores a fixed size of however many bytes you specify for your table, no matter how many characters occupy a field of this type per row."
char(Character) can hold only 255 character. but varchar(variable length character) can hold up to over 25,000. For larger input, use text instead of varchar. It can hold a large a mount of character.