Home / SQL / Reference / Text functions

SQL UPPER and LOWER

Change text to capitals or small letters.

Syntax

UPPER(text)
LOWER(text)

Also handy for comparing text without caring about case: LOWER(name) = 'mia chen'.

Example

Query (on the shop database used in the SQL course)

SELECT name, UPPER(name) AS upper_name, LOWER(country) AS lower_country
FROM customers
LIMIT 4;

Result

nameupper_namelower_country
Aarav SharmaAARAV SHARMAnew zealand
Mia ChenMIA CHENaustralia
Liam WalkerLIAM WALKERaustralia
Sita GurungSITA GURUNGaustralia

4 rows

Related

Learn it step by step in the free lesson Functions: Text, Numbers, Dates & CASE, with exercises that check your queries.