Assigning collation sequences from SQL

Each column of each table has a default collation type. If a column requires a collation type other than BINARY, you can define the preferred collation type by specifying a COLLATE clause as part of the CREATE TABLE column definition.

Whenever QDB compares two text values, it uses a collation sequence to determine the results of the comparison according to the following rules:

The expression x BETWEEN y and z is equivalent to x >= y AND x <= z. The expression x IN (SELECT y ...) is handled in the same way as the expression x = y for the purposes of determining the collation sequence to use. The collation sequence used for expressions of the form x IN (y, z ...) is the default collation type of x if x is a column, or BINARY otherwise.

An ORDER BY clause that's part of a SELECT statement may be assigned a collation sequence to be used for the sort operation explicitly. In this case, the collation sequence named by the COLLATE clause is used. Otherwise, if the expression sorted by an ORDER BY clause is a column, then the default collation type of the column is used to determine sort order. If the expression is not a column, then the BINARY collation sequence is used.