What is the difference between char and varchar data types?

Answer Posted / paras nath

The char is a fixed-length character data type, the varchar is a variable-length character data type.

Because char is a fixed-length data type, the storage size of the char value is equal to the maximum size for this column. Because varchar is a variable-length data type, the storage size of the varchar value is the actual length of the data entered, not the maximum size for this column.

You can use char when the data entries in a column are expected to be the same size.
You can use varchar when the data entries in a column are expected to vary considerably in size.

Is This Answer Correct ?    53 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to shutdown mysql server?

582


How do I declare a variable in mysql?

480


Does uninstalling mysql delete database?

496


What is the purpose of using timestamp data type?

505


How do I view data in mysql workbench?

515






What are the critical issues you have resolved in your company

1762


How to calculate expressions with sql statements?

498


How do I assign a variable in mysql?

481


How do I change the max connection in mysql?

519


How do I create a stored procedure in mysql?

497


What is prepare statement in mysql?

515


What are queries used for?

510


Define REGEXP?

650


What is different between sql and mysql?

510


Where’s database data actually stored?

524