Ali
Ali

Reputation: 7483

SQL statement queries parameters become case sensitive how so?

I'm running a SQL query on my mysql database but for some reason its case sensitive like if an entry exists as 'NAME = Andrew' running a sql query like:

SELECT * WHERE NAME Like 'and%'

Doesn't work but

SELECT * WHERE NAME Like 'And%'

does work? WHat gives I'm running a php mysql set up here...

Upvotes: 1

Views: 550

Answers (3)

Tzury Bar Yochay
Tzury Bar Yochay

Reputation: 9004

Normally, if any expression in a string comparison is case sensitive, the comparison is performed in case-sensitive fashion.

http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html

Yet, someone thinks it is a bug http://bugs.mysql.com/bug.php?id=8847

Upvotes: 0

ty812
ty812

Reputation: 3323

From the MySQL Dev Site

"Normally, if any expression in a string comparison is case sensitive, the comparison is performed in case-sensitive fashion. "

Upvotes: 0

Alex
Alex

Reputation: 12433

It depends on your field's collation. For instance if you use utf8_general_ci for the 'name' field, it would be case insensitive on that query.

Upvotes: 6

Related Questions