Interview QuestionsCategory: MySQLWhat is Difference between CHAR and VARCHAR?
bestonetechnologies Staff asked 3 years ago

What is Difference between CHAR and VARCHAR?

1 Answers
bestonetechnologies Staff answered 3 years ago

Difference between CHAR and VARCHAR:
CHAR is fixed length: CHAR data type length is fixed to the length that is declared while creating table.
Ex. In field “name char(45)” we entered value “Albert”, it will take space of 45 characters.
VARCHAR is variable-length: VARCHAR data type length is not fixed as we declared while creating table, it varies as per data we entered.
Ex. In field “name varchar(45)” again we entered value “Albert”, it will take space of 6 characters. 

Your Answer

4 + 20 =