PostgreSQL – UPPER Function
The UPPER
function is used to convert all characters in a given string to uppercase. It takes a string as an argument and returns a new string where all alphabetic characters have been converted to their uppercase equivalents.
Here’s the basic syntax of the UPPER
function:
UPPER(string)
string
is the string or column that you want to convert to uppercase.
Here’s an example of using the UPPER
function:
SELECT UPPER('Hello, World!'); -- Returns 'HELLO, WORLD!'
You can also use the UPPER
function with column values in a table. For instance, if you have a table named employees
with a column named name
, you can convert all first names to uppercase like this:
SELECT UPPER(name) FROM employees;
This query will return a result set with all the name
values in uppercase.