List:General Discussion« Previous MessageNext Message »
From:Martin d'Anjou Date:April 28 2003 6:24pm
Subject:RE: Comparing ENUM in WHERE clause
View as plain text  
On Mon, 28 Apr 2003, Mirko D. Walter wrote:

> Hi,
> [...]
> >> This is perfectly right. green and red are both
> >> smaller than yellow, viewed from character-base.
> >
> >I thought enums were internaly represented as integers, and 
> >that was the
> >whole point of enums: use a symbolic name instead of a value, for
> >comparisons etc. I am not using the right data type then.
> This is perfectly true with most (all?) programming 
> languages. So the thinking is not wrong... it _should_
> be used this way... but... by the way: which value should be
> presented as 0, which one as 1 and so on? Most programming
> languages I know would incr. from char-value to char-value.

I thought MySQL would assign the values according to the definition order
and the NULL and empty string "" built-ins, as described in

I am gradually switching my code to use integers instead, but I now have
to maintain an associative array outside of the database for translating
numbers back into strings... or I guess I could define another table. If
only I could compare enums!


Comparing ENUM in WHERE clauseMartin d'Anjou28 Apr
RE: Comparing ENUM in WHERE clauseMartin d'Anjou28 Apr