ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Databases >> MySQL
 
 


 

 
 Oracle interview questions  Oracle Interview Questions (2036)
 SQL Server interview questions  SQL Server Interview Questions (1076)
 MS Access interview questions  MS Access Interview Questions (24)
 MySQL interview questions  MySQL Interview Questions (194)
 Postgre interview questions  Postgre Interview Questions (6)
 Sybase interview questions  Sybase Interview Questions (22)
 DB Architecture interview questions  DB Architecture Interview Questions (5)
 DB Administration interview questions  DB Administration Interview Questions (213)
 DB Development interview questions  DB Development Interview Questions (53)
 SQL PLSQL interview questions  SQL PLSQL Interview Questions (771)
 Databases AllOther interview questions  Databases AllOther Interview Questions (106)
Question
What is the difference between char and varchar data types?
 Question Submitted By :: MySQL
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
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 ?    343 Yes 20 No
Dinesh Goyal
 
Answer
# 2
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 ?    80 Yes 6 No
Preeti Singh
 
 
 
Answer
# 3
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 ?    48 Yes 6 No
Paras Nath
 
Answer
# 4
i m totally aggred with answer no 1 so my answer will be also like that 
Is This Answer Correct ?    1 Yes 0 No
Sonu Kumar
 
Answer
# 5
char stores only character values whereas varchar can
stores alphanumerics values. searching is faster in char in
comparision of varchar
 
Is This Answer Correct ?    52 Yes 76 No
Deven Verma
 
Answer
# 6
no 
Is This Answer Correct ?    40 Yes 85 No
Kav
 

 
 
 
Other MySQL Interview Questions
 
  Question Asked @ Answers
 
What is Foreign Key? What is the main difference between primary key and Foreign Key ? How Foreign Key can be defined? Is Foreign key is used to join two or more table?   4
what is the advantage of stored procedures, triggers and indexing in mysql   1
What is the difference between char and varchar data types?   6
How can we find the number of rows in a table using MySQL?   3
Difference between MYSQL_ASSOC,MYSQL_NUM and MYSQL_BOTH ? TCS 2
maximum size of a database in mysql?   2
A company wants to store their invoices in a database. They already have their customers and articles in that database. Both customer and article are each identified by an unique integer value. Please create the SQL statements for creating the necessary table(s) for storing the invoices in a MySQL database. An invoice should hold information like invoice number, customer, date, article(s) and quantity etc.   1
Explain TIMESTAMP DEFAULT ?2006:09:02 17:38:44′ ON UPDATE CURRENT_TIMESTAMP.   1
What is the difference Delete and Drop ?   6
how we connect the data base in any programme   2
how we can use more then one primary key in Single Table Systematix 9
how we can find nth max salary from an employe table by using my sql?   8
 
For more MySQL Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com