Lesson

MySQL LOWER() Function

10 min reading
Free Course

MySQL LOWER() Function

The LOWER() function converts uppercase characters in a string to lowercase according to the active character set mapping. It is the ANSI SQL standard counterpart to MySQL's LCASE() alias.

Syntax

LOWER(str)
  • str: A character string or column expression.
  • Return value: Lowercased character string, or NULL if str is NULL.

Under utf8mb4, LOWER() handles both ASCII and international letters accurately, turning 'MÜNCHEN' into 'münchen'.

Practical Example

Suppose demo_customers receives signups with inconsistent capitalization in email and city. You can clean up reports and generate uniform lowercase handles with LOWER().

SELECT
    customer_id,
    LOWER(email) AS clean_email,
    LOWER(city) AS clean_city
FROM demo_customers
ORDER BY customer_id;
customer_id clean_email clean_city
1 alex.vega@shop.io austin
2 mia.keller@shop.io münchen
3 NULL tokyo

In row 3, email is NULL, so LOWER(email) returns NULL while city converts normally.

Common Mistakes & NULL Behavior

  • Wrapping indexed columns in WHERE: Writing WHERE LOWER(email) = 'a@b.com' prevents MySQL from using a normal B-tree index on email, forcing a full table scan. In MySQL 8.0+, either rely on a case-insensitive collation (utf8mb4_0900_ai_ci) or create a functional index on ((LOWER(email))).
  • Binary strings stay uppercase: LOWER() ignores BINARY, VARBINARY, and BLOB columns because binary bytes have no character set. Convert them first via LOWER(CONVERT(col USING utf8mb4)).
  • NULL inputs: Passing NULL returns NULL.

Frequently Asked Questions

Should I write LOWER() or LCASE() in new MySQL queries?

Prefer LOWER(). It works identically to LCASE() in MySQL and runs without changes in PostgreSQL, SQLite, and SQL Server.

Does LOWER() modify characters during an INSERT or SELECT?

Calling LOWER() inside SELECT only formats the query output. To store lowercase text permanently, call LOWER() inside INSERT or UPDATE statements.

Can LOWER() handle Turkish dotted and dotless I correctly?

Case mapping depends on the string's character set and collation rules, so verify locale-specific characters if your app uses utf8mb4_tr_0900_ai_ci.

Save Your Progress

Unlock Your
Full Potential.

Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.

Quick Access With

Enterprise-Grade Security Protocol

Try it Yourself

Experiment with the code from this lesson in our interactive playground.

Open Playground
MySQL Topic Hub

Stuck on this lesson?

Join our community of senior developers.

Ask in Forum