[EMAIL PROTECTED] wrote:
Hi all,

I've got a question. We were testing something on our mysql server (
4.0.21) with MyISAM tables. When we executed the query "select * from people where name like '';" we expected the same results as "select * from people where name='';" but it didn't.

The like function returned everything instead of only the people without a name. Is this known (and correct) behaviour? It does not sound logical to me. I couldn't find anything about it on the mysql website.


Usually, pattern matching done where a pattern is nothing matches everything.

Use LIKE for pattern matching, and = for equivalency.

I don't know what the ANSI SQL spec says here, and whether our behavior
is correct there, but this behavior makes sense to me at least.  I would
expect similar behavior from perl, for example:

$ perl -e 'my $a = qw(a); print $a =~ //;'
1

Regards,

Josh
--
Josh Chamas
Director, Professional Services
MySQL Inc., www.mysql.com
Get More with MySQL!  www.mysql.com/consulting

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to