StringsSQL standard

UPPER

Converts text to uppercase.

Syntax

UPPER(<text>)

Makes every letter uppercase; other characters don't change. Its mirror function is LOWER, which makes letters lowercase. Often used to display codes, abbreviations or headings consistently, or to compare text regardless of case.

Data for the examples

employees

namedepartmentsalarybonusphone
Emmabackend1200300+44 7700 900123
Liambackend1000NULLNULL
Oliviafrontend1350150+44 7700 900456
Noahfrontend950NULL+44 7700 900789
Sophiadesign1200200NULL

These tables already exist in the sandbox — the examples below use them. Want to try this in your own database? Copy the SQL.

In uppercase
SELECT UPPER('Hello, SQL') AS upper_case;
upper_case
HELLO, SQL
Departments in uppercase
SELECT name, UPPER(department) AS department
FROM employees;
namedepartment
EmmaBACKEND
LiamBACKEND
OliviaFRONTEND
NoahFRONTEND
SophiaDESIGN
Case-insensitive search
SELECT name, department
FROM employees
WHERE UPPER(department) = UPPER('Backend');
namedepartment
Emmabackend
Liambackend

Both sides in uppercase — and backend in the table matches Backend in the query.

Watch out

Bring both sides to the same case: UPPER(department) = 'Backend' finds nobody, because the left side is all uppercase.

An index on an expression only helps that same expression: an index on LOWER(name) won't speed up a query with UPPER(name). Pick one case for all your searches.

Not every letter has an obvious uppercase counterpart: UPPER('straße') gives STRAẞE with the rare capital ß, not STRASSE.

Related functions

Learn more in the course