Skip to main content

upper

1. UPPER Function

The UPPER function in H2 database is used to convert a given string to uppercase.

2. Syntax

The syntax for the UPPER function in H2 database is as follows:

UPPER(string)

Arguments

  • string: The string that needs to be converted to uppercase. It should be a character string or a column of character data type.

Return

  • The UPPER function returns the input string converted to uppercase.

3. Notes

  • The UPPER function in H2 database converts all lowercase letters in the string to uppercase.
  • If the input string is already in uppercase or contains characters other than alphabets, it remains unchanged.
  • The UPPER function is case-sensitive, so make sure to use the correct case while calling the function.

4. Examples

Here are a few examples demonstrating the usage of the UPPER function in H2 database:

Example 1 - Converting a string to uppercase:

SELECT UPPER('hello') AS uppercase_string;

Output:

uppercase_string
----------------
HELLO

Example 2 - Converting a column values to uppercase:

CREATE TABLE names (
id INT PRIMARY KEY,
name VARCHAR(50)
);

INSERT INTO names VALUES (1, 'john'), (2, 'emma'), (3, 'david');

SELECT id, name, UPPER(name) AS uppercase_name
FROM names;

Output:

id | name  | uppercase_name
---+-------+---------------
1 | john | JOHN
2 | emma | EMMA
3 | david | DAVID
  • lower - Convert a string to lowercase
  • INITCAP - Convert the first character of each word to uppercase