As far as I know LIKE operator should be case insensitive, but if I have the string “ABC Software” and I get the following query:
SELECT ...
FROM ...
WHERE ... LIKE 'AbC Softwa%'
I get a zero-rows result set (If I upper-case the second letter, the b, I get the right result). Why? Previously I had *utf8_bin* as character encoding, so I switch to *latin_swedish_ci*, supposing that binary matching was the source of all errors, but I get the same problem.
MySQL is case-insensitive by default.
If you want to perform a case-sensitive search use:
If your database, or table is configured to be case-sensitive by default, then to perform a case-insensitive search, you need to do something like this:
If you are using utf8, then try this:
You might want to investigate why your database is case-sensitive.
To see how the server is configured, run:
To see the collation of your tables, run:
And to see the default collation for the database:
where
dbnameis the name of the database.