What is the difference between char and varchar data types?
Answers were Sorted based on User's Feedback
Answer / dinesh goyal
char is used for fixed length memory storage whereas varchar
is used for variable lenght memory storage.
Fox Example if we have char(10) then we can store 10 bit
value in it but if we store only 6 bit value in it then rest
of the 4 bit space is goes wasted. this limitation is
overcome by varchar.
In varchar if we use less space than define space the rest
of space is not wasted.
| Is This Answer Correct ? | 363 Yes | 24 No |
Answer / preeti singh
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 ? | 90 Yes | 7 No |
Answer / 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 |
Answer / sonu kumar
i m totally aggred with answer no 1 so my answer will be also like that
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / deven verma
char stores only character values whereas varchar can
stores alphanumerics values. searching is faster in char in
comparision of varchar
| Is This Answer Correct ? | 53 Yes | 80 No |
How much does mysql enterprise cost?
How MySQL is different from SQL?
17 Answers HCL, IBM,
How can we optimize stored procedure?
How do I exit mysql?
what is the difference between the nvl function, ifnull function, and the isnull function? : Mysql dba
How many rows mysql can handle?
How do I install mysql on windows 10 64 bit?
Is there a way to see the files which are stored?
what is the difrence between sql and pl/sql
How can you import tables from a sql file into a database by using the mysql client?
What is the purpose of mysql database?
How is myisam table stored?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)