List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 26 1999 4:51pm
Subject:Re: CHAR(0)
View as plain text  
At 1:02 PM +0300 7/26/99, Jani Tolonen wrote:
>Gerald Clark writes:
>
> > I noticed in the 3.23.o change log that we can now create
> > CHAR(0) columns.  Why?
>
>Hello Gerald,
>
>This is kind of like... a little same as... for example when people
>didn't at first understand why we would ever need a number like
>zero? It is nothing, right? And thereafter someone got the strange
>notion that negative numbers were also needed? Absolutely
>crazy!  :) :) :) Well, I had to ask the same question from Monty,
>too. ;)
>
>An example: lets assume that someone wants to import data from a tab
>delimited text file to MySQL. He also wants the table to look the same
>as the original table was, i.e. he wants the same field names and in
>the exact same order in the new table as the original. However, he
>doesn't want the data from a specific field to be imported. A solution
>is to create that specific field with type CHAR(0). The data imported
>to that field will be destroyed and the field only takes one bit. So
>if it is desired afterwards that the field should contain data again,
>one can use the 'ALTER TABLE' -command. The benefit is that the name
>of the field and the position of that field in the table is still
>known.


You can also use it as a placeholder when you know you'll want a
column in the table but you're not yet sure how wide to make it.
When you figure that out later, you can use ALTER TABLE to widen
it.

-- 
Paul DuBois, paul@stripped
Thread
CHAR(0)Gerald Clark21 Jul
  • CHAR(0)Jani Tolonen26 Jul
    • Re: CHAR(0)Paul DuBois26 Jul