Lesson

MySQL LCASE() Function

10 min reading
Free Course

MySQL LCASE() Function

The LCASE() function converts every uppercase letter in a string to lowercase using the active character set rules. It is a MySQL alias for the standard SQL LOWER() function.

Syntax

LCASE(str)
  • str: Any non-binary string expression or column.
  • Return value: A lowercased string, or NULL when str is NULL.

MySQL supports full Unicode case mapping in utf8mb4, so accented characters like 'É' and 'Ü' convert cleanly to 'é' and 'ü'.

Practical Example

Employees in demo_employees sometimes enter email addresses with mixed capital letters. You can normalize them with LCASE() before exporting directory records.

SELECT
    employee_id,
    email AS original_email,
    LCASE(email) AS normalized_email
FROM demo_employees
ORDER BY employee_id;
employee_id original_email normalized_email
1 Sarah.Kim@Acme.COM sarah.kim@acme.com
2 J.Müller@Acme.COM j.müller@acme.com
3 NULL NULL

Row 2 demonstrates Unicode folding: both 'J', 'M', 'COM', and accented letters fold accurately under utf8mb4.

Common Mistakes & NULL Behavior

  • Binary columns remain unchanged: LCASE() does not modify BINARY, VARBINARY, or BLOB data because binary types lack character-set case rules. Convert them first with CONVERT(col USING utf8mb4) before calling LCASE().
  • Breaking index scans in WHERE clauses: Writing WHERE LCASE(email) = 'a@b.com' blocks standard B-tree index lookups and forces full table scans. Rely on a case-insensitive collation (utf8mb4_0900_ai_ci) or add a functional index instead.
  • NULL input returns NULL: Missing emails remain NULL without throwing an error, while empty strings stay ''.

Frequently Asked Questions

Is there any difference between LCASE() and LOWER()?

No. Both produce identical results in MySQL. Most teams prefer LOWER() for standard SQL compatibility across PostgreSQL and SQLite.

Can LCASE() change numbers or punctuation?

No. Digits, hyphens, @ symbols, and spaces pass through untouched.

How do I lowercase only the first letter of a string?

Combine LCASE(LEFT(col, 1)) with SUBSTRING(col, 2) using CONCAT().

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