How to Do Case-Insensitive Match With SQLite IN Operator?

You can do case-insensitive matches with SQLite IN (or NOT IN) operator by adding COLLATE NOCASE operator after an expression (that's to the left of IN or NOT IN operators), for example, like so:

SELECT *
FROM `table`
WHERE `column` COLLATE NOCASE IN ('foo', 'bar')

This will match all (case-insensitive) variations of the values specified to the right of IN (or NOT IN) operator.


This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.