I am trying to execute the sql query:
select * from table where column like \'%value%\';
But the data is saved as \'Value\' ( V is capital ).
If you want this column be case insensitive :
ALTER TABLE `schema`.`table`
CHANGE COLUMN `column` `column` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
Thus, you don't have to change your query.
And the MySQL engine will process your query quicker than using lower() function or any other tricks.
And I'm not sure that using lower function will be a good solution for index searching performance.
Try using a case insensitive collation
select * from table
where column like '%value%' collate utf8_general_ci
Use the lower()
function:
select t.*
from table t
where lower(column) like '%value%';