UPPER
The UPPER function in SQL converts all lowercase alphabetic characters in a specified string to uppercase.
Syntax
UPPER(string)
Parameters
string: The original string to convert.
Return Value
The function returns a new string that is the same as the original string, but with all lowercase characters converted to uppercase. Non-alphabetic characters in the string are unaffected.
Errors
- If the
stringargument is not a string, aFunctionRequiresStringValueerror will be returned.
Examples
Consider a table Item created and filled with the following data:
CREATE TABLE Item (
name TEXT
);
INSERT INTO Item VALUES ('abcd'), ('Abcd'), ('ABCD');
You can use the UPPER function to convert all name values to uppercase:
SELECT UPPER(name) AS upper_name FROM Item;
This will return:
ABCD
ABCD
ABCD
Note that the UPPER function affects only alphabetic characters. Non-alphabetic characters in the string remain unchanged.