UPPER() in MySQL — How It Works

What the MySQL UPPER() function does, with an example.

Published October 18, 2026

UPPER() converts a string to uppercase; UCASE is a synonym.

How it works

Collation decides case-sensitivity for comparisons, so UPPER is only needed when you want the converted value itself.

Try it in MySQL

SELECT UPPER('Hello')
HELLO
SELECT UPPER(name) FROM users LIMIT 1
ADA
SELECT UPPER(NULL)
NULL

Practical examples

Example 1

SELECT UPPER('Hello');
-- HELLO

Example 2

SELECT UPPER(name) FROM users LIMIT 1;
-- ADA

Example 3

SELECT UPPER(NULL);
-- NULL

Use it in a real query

SELECT id, UPPER('Hello') AS result
FROM your_table
LIMIT 10;

Common mistakes

  • Using UPPER in WHERE on indexed columns, which disables the index.
  • Assuming comparisons are case-sensitive in utf8mb4_general_ci.
  • Locale-specific letters (e.g. ß) behaving unexpectedly.

Key takeaways

  • UPPER() in one line: UPPER() converts a string to uppercase; UCASE is a synonym.
  • Try queries in a test database first.
  • Check NULL handling and data types.

FAQ

Do I need UPPER for case-insensitive search?

Usually not; the default collation is already case-insensitive.

Does UPPER() work in other databases?

Most have an equivalent, but names and syntax vary between MySQL, PostgreSQL, SQL Server and SQLite.

More SQL articles