BigQuery · String function
BigQuery LOWER
LOWER(value) converts a string to lowercase using Unicode case rules: LOWER('Ana@Example.COM') returns ana@example.com. Use it to normalize emails, codes and free text before comparing, grouping or joining.
LOWER maps every alphabetic character of a STRING to its lowercase form, using the Unicode Character Database without language-specific rules. Accented and non-Latin letters are converted too, so LOWER('ÉLODIE') returns élodie. For BYTES, only ASCII letters change and bytes above 127 are left as they are.
The usual use is case-insensitive matching: LOWER(email) = LOWER(@input), or grouping values that differ only in case. For a one-off filter, REGEXP_CONTAINS with (?i) or CONTAINS_SUBSTR avoids rewriting the column.
Because there are no locale rules, a few languages come out differently than a native speaker expects: the Turkish dotted capital İ becomes i plus a combining dot, which makes the string one character longer. UPPER is the opposite function.
Syntax
LOWER(value)Arguments and return value
| Argument | Description |
|---|---|
value | The STRING or BYTES value to convert. |
Returns: STRING or BYTES, the same type as value.
Examples
Lowercase mixed text
SELECT
LOWER('Ana@Example.COM') AS email,
LOWER('ÉLODIE DUPONT') AS accented,
LOWER('SKU-42A') AS code;| accented | code | |
|---|---|---|
| ana@example.com | élodie dupont | sku-42a |
Deduplicate emails that differ only in case
TRIM removes the stray leading space before LOWER normalizes the case.
WITH signups AS (
SELECT 'Ana@Example.com' AS email UNION ALL
SELECT 'ana@example.com' UNION ALL
SELECT ' ANA@EXAMPLE.COM' UNION ALL
SELECT 'ben@example.com'
)
SELECT LOWER(TRIM(email)) AS normalized_email, COUNT(*) AS signups
FROM signups
GROUP BY normalized_email
ORDER BY normalized_email;| normalized_email | signups |
|---|---|
| ana@example.com | 3 |
| ben@example.com | 1 |
No locale-specific rules
The Turkish İ becomes i plus a combining dot above (U+0307), so the 8-letter word becomes 9 characters.
SELECT
LOWER('İSTANBUL') = 'istanbul' AS matches_plain_i,
LENGTH(LOWER('İSTANBUL')) AS length_after_lower;| matches_plain_i | length_after_lower |
|---|---|
| false | 9 |
Common mistakes
- Lowercasing a clustered column in a filter.
WHERE LOWER(customer_email) = 'ana@example.com'wraps the clustered column in a function, so BigQuery can't prune blocks. Store a normalized column and filter on it. - Forgetting to trim as well.
LOWER(' Ana@Example.com')still has the leading space; combine with TRIM when normalizing keys. - Expecting LOWER on BYTES to handle non-ASCII text. Only ASCII letters change; cast to STRING first.
- Using ILIKE from PostgreSQL or Snowflake. BigQuery has no ILIKE; write
LOWER(col) LIKE '%abc%'.
Cost and performance
- Wrapping a clustered column in LOWER (or any function) in a WHERE clause disables block pruning on that column, so the query reads more data. Materialize the normalized value in its own column if you filter on it often.
- On a table with a search index that uses the default LOG_ANALYZER, BigQuery can still use the index for
LOWER(column) = 'literal'comparisons.
FAQ
How do I do a case-insensitive comparison in BigQuery?
Compare lowercased values: LOWER(a) = LOWER(b). For pattern matching use LOWER(col) LIKE '%term%' or REGEXP_CONTAINS(col, r'(?i)term'). Collation with COLLATE(col, 'und:ci') is another option.
Does BigQuery have ILIKE?
No. Use LOWER(col) LIKE LOWER('%Pattern%'), or REGEXP_CONTAINS with the (?i) flag.
Does LOWER change non-English letters?
Yes, for STRING values it follows Unicode case mappings, so É becomes é and Cyrillic or Greek capitals are lowercased too.
Related
More string functions
All BigQuery string functions · All functions · BigQuery error messages
