At 4:39 PM -0400 7/15/99, Dan Ray wrote:
>Sasha et al--
>
>> When specify they value of a CHAR column, make sure put it in quotes =
>> '00'
>
>Right, I got that. I mean, I knew it, but when I typed it my fingers forgot
>about it.
I would say that the behavior you've observed is a result of MySQL's
comparison rules:
Comparison operations result in a value of `1' (TRUE), `0' (FALSE) or
`NULL'. These functions work for both numbers and strings. Strings are
automatically converted to numbers and numbers to strings as needed (as
in Perl).
*MySQL* performs comparisons using the following rules:
* If one or both arguments are `NULL', the result of the comparison
is `NULL'.
* If both arguments in a comparison operation are strings, they are
compared as strings.
* If both arguments are integers, they are compared as integers.
* If one of the arguments is a `TIMESTAMP' or `DATETIME' column and
the other argument is a constant, the constant is converted to a
timestamp before the comparison is performed. This is done to be
more ODBC-friendly.
* In all other cases, the arguments are compared as floating-point
(real) numbers
>Does that mean that any value in a char column equals numeric zero? That's a
>little harsh on folks who forget the quotes like this, doncha think?
You could say that. On the other hand, it's also a good idea to try out
a WHERE clause using a SELECT first to see what it selects...
--
Paul DuBois, paul@stripped