UPPER Function - SQL


Overview


The UPPER function in SQL converts all characters in a string to uppercase. It is useful for standardizing text to uppercase.

Example:

SELECT UPPER('Hello, world')

Syntax:

SELECT UPPER(string_expression)

string_expression is the string you want to convert to uppercase.

Sample Data:

department_id first_name
3 Frank
2 Jane
3 Ashley
NULL Glenn
2 Kelly
1 Richard
1 George
5 Kyle
2 James
1 Gustavo

Example: Hard-coded value


In this example, we are returning the string ‘Hello, world’ in all uppercase, the final output is ‘HELLO, WORLD.’


Example: Query without the WHERE Statement


In this example, we are returning all of the rows in the first_name column in all uppercase.


Example: Query with the WHERE Statement


In this example, we are returning all of the rows in the first_name column in all uppercase where the department_id equals 1.