Check if string or character exists in MySQL database row

SELECT * FROM 'mytable' WHERE INSTR('mycol', 'abc') > 0

The above example return all rows in table “mytable” where the column “mycol” contains the string “abc”.

Source

INSTR on MySQL.com

4 thoughts on “Check if string or character exists in MySQL database row

  1. Matthias Radde

    The mentioned command is case-sensitive.
    If you need it case-insensitive this one should work:
    SELECT * FROM `mytable` WHERE `mycol` LIKE ‘%abc%’;

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.