Name
COLLATE — Associate a specific collation to an expression
Syntax
Description
The COLLATE operator associates a specific
collation with an expression. The COLLATE operator does not alter the value of
the expression, but it does change how equality and ordering are
tested in the enclosing expression.
If two text expressions are involved in an equality or order test, the collation is determined with the following rules:
If the lefthand (first) expression has an explicit collation, that is used.
If the righthand (second) expression has an explicit collation, that is used.
If the lefthand (first) expression is a direct reference to a column with a collation, the column collation is used.
If the righthand (second) expression is a direct reference to a column with a collation, the column collation is used.
The default
BINARYcollation is used.
For example:
'abc' == 'ABC' => 0 (false) 'abc' COLLATE NOCASE == 'ABC' => 1 (true) 'abc' == 'ABC' COLLATE NOCASE => 1 (true) 'abc' COLLATE NOCASE == 'ABC' COLLATE BINARY => 1 (true) 'abc' COLLATE BINARY == 'ABC' COLLATE NOCASE => 0 (false)
For more information on collations, see Collation Functions.
See Also
CREATE TABLE, sqlite3_create_collation() [C API, Ap G]
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access