> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oxla.com/llms.txt
> Use this file to discover all available pages before exploring further.

# UPPER

## Overview

The `UPPER()` function returns a given string, an expression, or values in a column in all uppercase letters. The syntax of the function is illustrated below:

```sql theme={null}
UPPER(string)
```

It accepts input as a string and returns text in uppercase letters.

**Special Case:**

* If characters in the input are not of type string, they remain unaffected by the `UPPER()` function.
* We support Unicode for the `UPPER()` function.

## Examples

### #Case 1: Basic `UPPER()` function

The following basic query converts the given string in all uppercase alphabets:

```sql theme={null}
SELECT UPPER('PostGreSQL');
```

The final output will be as follows:

```sql theme={null}
+-------------+
| upper       |
+-------------+
| POSTGRESQL  |
+-------------+
```

### Case 2: UPPER() function using columns and CONCAT() function

Let’s see how the `UPPER()` function works using an example with columns. We have a table named **personal\_details** containing employee's **id**, **first\_name**, **last\_name**, and **gender** of a retail store:

```sql theme={null}
CREATE TABLE personal_details (
  id int,
  first_name text,
  last_name text,
  gender text
);
INSERT INTO personal_details 
    (id, first_name, last_name, gender) 
VALUES 
    (1,'Mark','Wheeler','M'),
    (2,'Tom','Hanks','M'),
    (3,'Jane','Hopper','F'),
    (4,'Emily','Byers','F'),
    (5,'Lucas','Sinclair','M');
```

```sql theme={null}
SELECT * FROM personal_details;
```

The above query will show the following table:

```sql theme={null}
+-----+-------------+-------------+----------+
| id  | first_name  | last_name   | gender   |
+-----+-------------+-------------+----------+
| 1   | Mark        | Wheeler     | M        |
| 2   | Tom         | Hanks       | M        |
| 3   | Jane        | Hopper      | F        |
| 4   | Emily       | Byers       | F        |
| 5   | Lucas       | Sinclair    | M        |
+-----+-------------+-------------+----------+
```

Let’s assume that:

1. We want to convert employees' first and last names with **id** numbers 1, 3, and 5 to all uppercase letters.
2. Then, combine them using the `CONCAT()` function into one **full\_name** column in uppercase.

It can be done using the following query:

```sql theme={null}
SELECT CONCAT (UPPER(first_name),' ', UPPER(last_name))
as full_name
FROM personal_details
where id in (1, 3, 5);
```

The output displays the first and last names of employees with the specified ids in uppercase letters:

```sql theme={null}
+---------------------+
| full_name           |
+---------------------+
| MARK WHEELER        |
| JANE HOPPER         |
| LUCAS SINCLAIR      |
+---------------------+
```
