SQL – Char vs. Varchar

Memory allocation is static for char data type variables but in case of varchar memory allocation is dynamic. This is the basic difference between char and varchar.

Example

create table test1
(
name1 char(10),
name2 varchar(10)
);

Insert into test1 values ('Varinder','Varinder');

select * from test1;
SQL - Char vs. Varchar

SQL – Char vs. Varchar

I hope this will help.