UPPER function is used to convert lower case string to upper case string.
Syntax of UPPER Function :
UPPER ( character_expression )
character_expression is an expression of character or binary data. character_expression can be a constant, variable, or column.
Return type of RIGHT function is varchar.
Examples of UPPER Function :
Example 1 : Use of UPPER function in select clause
SELECT UPPER('syntax-example')
Output
SYNTAX-EXAMPLE
Above example returns specified string in upper case.
Example 2 : Use of UPPER function to display field value of table.
SELECT UPPER(ContactName) AS 'Customer Name'
FROM Customers
Output
Customer Name
MARIA ANDERS
ANA TRUJILLO
ANTONIO MORENO
THOMAS HARDY
CHRISTINA BERGLUND
HANNA MOOS
Above example displays customer name in upper case of customer table.
Example 3 : Use of UPPER function in where clause
SELECT ContactName, CompanyName
FROM Customers
WHERE UPPER(ContactName) LIKE 'MARIA %'
Output
ContactName CompanyName
Maria Anders Alfreds Futterkiste
Maria Larsson Folk och fä HB
Above example displays customers having name as 'MARIA'.