ILIKE is normally used as part of a WHERE clause. ILIKE is case-insensitive; use LIKE for case-sensitive pattern matching. Note that Firebolt uses the POSIX locale, which means that it only classifies the ASCII letters “A” through “Z” and “a” through “z” as letters.
Syntax
Parameters
| Parameter | Description | Supported input types |
|---|---|---|
<expression> | Any expression that evaluates to TEXT | TEXT |
<pattern> | Specifies the pattern to match (case-insensitive). The pattern can be a constant or any TEXT expression, including a column reference. | TEXT. SQL wildcards are supported: * Use an underscore ( _) to match any single character* Use a percent sign ( %) to match any number of any characters, including no characters. |
Return Type
BOOLEAN
Example
Find nicknames from theplayers table that partially match the string “Joe” and any following characters as follows:
| playerid int null | nickname text null | email text null |
|---|---|---|
| 145 | joel53 | james96@example.com |
| 1356 | joel35 | smithaustin@example.net |
| 2823 | joe12 | thompsondana@example.org |
| 3232 | joe30 | gabrielle32@example.org |
| 3872 | joemata | nashrodney@example.com |
| 4655 | joel68 | browntina@example.org |
| 4880 | joel47 | kristinarivas@example.com |
Rows: 7Execution time: 2.46ms
Example using a non-constant pattern
The pattern doesn’t have to be a literal. You can match each row against a pattern stored in another column. For example, given afilters table that holds one pattern per row, join it with players to return the nicknames that match any of the patterns:
JOE% and %LONG, this returns nicknames such as joedavis, joe79, and joellong regardless of case.
Unicode Behavior
Firebolt uses thePOSIX locale, therefore ILIKE case insensitivity is limited to ASCII characters. The uppercase and lowercase versions of non-ASCII characters are not matched.
Returns false — Æ is non-ASCII, so ENCYCLOPÆDIA does not match encyclopædia:
| ?column? boolean |
|---|
| False |
Rows: 1Execution time: 4.99ms
true — the non-ASCII Æ matches itself, and the ASCII letters match case-insensitively:
| ?column? boolean |
|---|
| True |
Rows: 1Execution time: 4.86ms
false — Ü is non-ASCII, so MÜNCHEN does not match München:
| ?column? boolean |
|---|
| False |
Rows: 1Execution time: 5.79ms
true — the non-ASCII Ü matches itself, and the ASCII letters match case-insensitively:
| ?column? boolean |
|---|
| True |
Rows: 1Execution time: 6.58ms
false — Greek letters are non-ASCII and are never case-folded:
| ?column? boolean |
|---|
| False |
Rows: 1Execution time: 5.16ms