August 30th, 2011, 04:20 PM
SQL Case Insensitive Search
Can you please tell me how I can do the following search but make it case insensitive?
I want to be able to find either 'Carlos' or 'carlos' in my SQL statement but I can't find anything on Google that shows me how to correct my SQL statement...
SELECT * FROM dp_user WHERE user_name = 'Carlos';
Empty set (0.00 sec)
August 30th, 2011, 10:59 PM
which database system are you using?
you posted in the "database management" forum, which is this site's catch-all forum for database systems which don't have their own specific forum, namely DB2, MySQL, Postgresql, Firebird, Microsoft SQL Server, and Oracle
without knowing which database system you're running, it's very hard to solve specific issues, such as case sensitivity
August 31st, 2011, 09:18 AM
I'm using PostgreSQL and at times I have two systems that run MySQL.
August 31st, 2011, 09:30 AM
Note that this will prevent usage of an index on the user_name column, so for large tables this will be quite inefficient.
WHERE lower(user_name) = lower('Carlos');
August 31st, 2011, 10:11 AM
How is that command different from:
WHERE lower(user_name) = 'carlos';