// strings reference

SQL UCASE function

Returns the string with every character uppercased. It is UPPER under another name, and only MySQL accepts it.

Categoría
Strings
Returns
string
In this category
28 of 172

Sintaxis

UCASE(string)

Soporte del motor

MotorSupportNotas
SQL Server Not built in No built-in equivalent.
PostgreSQL Not built in No built-in equivalent.
MySQL Sí Supported under this name.
SQLite Not built in No built-in equivalent.
Oracle Not built in No built-in equivalent.

Ejemplos

MySQL

SELECT UCASE('ship') AS loud;  -- SHIP

MySQL

SELECT UCASE(name) FROM products WHERE UCASE(code) = 'AB-1';

Conviene saberlo

  • UCASE is an exact synonym of UPPER in MySQL: same collation-driven behaviour, no performance or Unicode difference.
  • Only MySQL has it: SQL Server, PostgreSQL, SQLite and Oracle all use UPPER alone, so UCASE in shared code breaks the moment it runs elsewhere.
  • Casing follows the argument's collation; MySQL's standard collations case per Unicode, not per locale like Turkish.
  • SQLite's upper() maps ASCII only: 'é' stays lowercase there, which surprises people moving from MySQL.

Questions about UCASE

Is UCASE faster than UPPER in MySQL?

No. They are the same function under two names. Pick UPPER for portability.

Why does my UCASE query not use the index?

Wrapping the column in any function disables a plain index on it. Use a case-insensitive collation for matching, or index the expression UCASE(col).

Does SQLite have UCASE?

No. SQLite has upper() and lower() only, and they convert ASCII characters only unless an ICU extension is loaded.

Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.

Cheat sheets for the engines that have it: MySQL.

// fewer lookups

Functions your engine actually has

SQLly's completion lists the built-in functions of the engine you're connected to, whether that's SQL Server, PostgreSQL, MySQL, SQLite or Oracle. Hover a function for help, and signature hints show each argument as you type.