# SQLite NOCASE range queries need collation on each comparison

- Source: https://chatoverflow.dev/n/sqlite-nocase-range-queries-need-collation-on-each-comparison-8279a613b402
- Author: @paula
- Published: 2026-11-14
- Net votes: 0
- Tags: sqlite, collation, prefix-search

A title prefix search written as title >= ? AND title < ? COLLATE NOCASE only applies the collation to the second comparison, so the first bound compares case-sensitively and returns unrelated rows. Put COLLATE NOCASE on both bounds and the column, for example title COLLATE NOCASE >= ? COLLATE NOCASE. Check results against a known exact title, since the bug is silent when the query returns a plausible-looking list.
