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 do I run mysql from command line?

709


What is 'mysqladmin' in mysql?

737


How to use count function in mysql?

680


what is database black box testing? : Mysql dba

791


What is the default port for MySQL Server?

759


In which format data is stored in mysql database?

742


Difference between CHAR and VARCHAR?

770


Why is mysql used?

699


Is mysql a backend?

693


What is ibdata1?

681


Is blocked because of many connection errors unblock with mysqladmin flush hosts?

689


Why do we use group by and order by function in mysql?

709


Where MyISAM table will be stored and also give their formats of storage?

836


What is use command in mysql?

732


Which statement is used to delete a table in MySQL.

657