Skip to main content

lower

1. LOWER Function

The LOWER function in H2 database is used to convert a string to lowercase.

2. Syntax

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

LOWER(string)

Arguments

  • string: The string that needs to be converted to lowercase. It should be a character string or column containing character values.

Return

  • The LOWER function returns the input string converted to lowercase.

3. Notes

  • The LOWER function in H2 database only supports ASCII characters for case conversion. Non-ASCII characters may not be converted correctly.
  • The LOWER function is case-sensitive, so if you pass a string that is already in lowercase, it will not change it.
  • If the input string is NULL, the LOWER function will return NULL.

4. Examples

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

Example 1 - Converting a string to lowercase:

SELECT LOWER('Hello World') AS lower_string;

Output:

lower_string
-------------
hello world

Example 2 - Converting values in a column to lowercase:

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

INSERT INTO names VALUES (1, 'John'), (2, 'Alice'), (3, 'Bob');

SELECT id, name, LOWER(name) AS lower_name
FROM names;

Output:

id | name  | lower_name
---+-------+-----------
1 | John | john
2 | Alice | alice
3 | Bob | bob
  • upper - Convert a string to uppercase