List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 3 1999 8:43pm
Subject:Re: How to have more then 255 characters?
View as plain text  
At 8:59 PM -0600 7/2/1999, Hawke Robinson wrote:
>Forgive my SQl ignorance, but how to I create a column than has a data
>type that will accept more than 255 characters?  I've been making
>multiple columns of varchar(255) to get around it, but this is awkward,
>and difficult to estimate, Please any suggestions would be greatly
>appreciated.  I've heard of Blob spaces, but is that just for images,
>and binary data?  Or can I put basic text in it, and what are it's
>limitations, and how to create them, etc? Or if that's not the correct
>route, please help guid me on this (hopefully very simple) issue.

Any of the string data types in MySQL can contain *any* kind of data,
including arbitary binary data.  The primary differences between the
various string types lie in how they are stored and how they are used
in comparisons.

CHAR is fixed-length.
VARCHAR and all the BLOB and TEXT types are variable-length.

By default, CHAR, VARCHAR, and TEXT types are case insensitive
in comparisons.  BLOB types are case sensitive.  You can make
CHAR/VARCHAR case sensitive by using the BINARY attribute when you
create your table.  For example:

	c1 CHAR(10),		/* case insensitive */
	c2 CHAR(10) BINARY	/* case sensitive */

In short, you use BLOB and TEXT when you want really long values,
and the choice between them depends on what kind of sort behavior you want.

(I've left out SET and ENUM, which are classified as string types,
because they probably don't apply to the question. :-))

Paul DuBois, paul@stripped
Northern League Chronicles:
How to have more then 255 characters?Hawke Robinson3 Jul
  • Re: How to have more then 255 characters?Jason Brooke3 Jul
  • Re: How to have more then 255 characters?Sasha Pachev3 Jul
  • Re: How to have more then 255 characters?Paul DuBois4 Jul