UPPER function in SQL
The UPPER function in SQL is used to convert a string to uppercase letters. It is a string function that can be applied to columns or string literals.
SQL Syntax
UPPER(string)
Example: Suppose we have a table employees with a column first_name containing names in various cases, and we want to display all names in uppercase.
| employee_id | first_name |
|---|---|
| 1 | John |
| 2 | Jane |
| 3 | MiChael |
| 4 | Sarah |
SQL
SELECT employee_id, UPPER(first_name) AS first_name_upper
FROM employees;
FROM employees;
The output of the above query is shown below:
| employee_id | first_name_upper |
|---|---|
| 1 | JOHN |
| 2 | JANE |
| 3 | MICHAEL |
| 4 | SARAH |