List:General Discussion« Previous MessageNext Message »
From:Emi Lu Date:August 16 2004 8:20pm
Subject:Why "VARCHAR" TO "CHAR" automatically when the length less than 4.
View as plain text  
Hello all,

I have a questions about "varchar columns" change to "CHAR columns" 
automatically.

When I designed a table t1

create table t1(id varchar(3) not null) in MySQL. After that, we use 
"desc t1" to see the description of table "t1".

The result is the following:
===============================
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | char(3) | YES  |     | NULL    |       |
+-------+---------+------+-----+---------+-------+

I did not understand why the varchar(3) is changed to char(3) 
automatically. While if we define a varchar(4) it will not change to 
char(4) automatically. Could somebody help and explain that please?

Thanks a lot!
Emi Lu




Thread
Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Emi Lu16 Aug
  • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Egor Egorov23 Aug
  • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Martijn Tonies23 Aug
    • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Joseph Cochran24 Aug
  • Re: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Martijn Tonies24 Aug
RE: Why "VARCHAR" TO "CHAR" automatically when the length less than 4.Victor Pendleton17 Aug