Search code examples
mysqlsqlsql-likecase-insensitive

SQL SELECT LIKE (Insensitive casing)


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 ).

When I execute this query i don't get any rows. How do i make the call such that, it looks for 'value' irrespective of the casing of the characters ?


Solution

  • use LOWER Function in both (column and search word(s)). Doing it so, you assure that the even if in the query is something like %VaLuE%, it wont matter

    select qt.*
    from query_table qt
    where LOWER(column_name) LIKE LOWER('%vAlUe%');