Hi,
"varChar" can adjust according to the requirement but 'char" cannot adjust that is why I will prefer "varChar" to save the memory space.
Main different between char and varchar is memory. See this example:
It is the structure of a table "emp"
empcode1 char(5),
empcode2 varchar(5)
So if i have inserted value of 4 characters in every column link "s001" then column "empcode1" will occupy 5 byts in memory but column "empcode2"
will occupy only 4 byts in memory. varchar utilize memory according number of characters but char will utilize memory according to its size.
Varchar is variable length and char is fixed length.
We should use char when size of column data is fixed.
We should use varchar when size of column data is not fixed.
char take only character values like a,b,c etc . but varchar can take any character,special char,numeric also.