MySQL Tutorial MySQL Advanced MySQL Database Account Management MySQL References

MySQL UPPER() Function



The MySQL UPPER() function converts all characters of the given string to uppercase. Any symbol, space, or number in the string is ignored while applying this function. Only alphabet are converted.

This function converts the characters using the current character mapping set, which is latin1, by default.

The UPPER() function is a synonym for the UCASE() function.

Syntax

UPPER(string)

Parameters

string Required. Specify the string to convert to uppercase.

Return Value

Returns the string with all characters of the specified string to uppercase.

Example 1:

The example below shows the usage of UPPER() function.

mysql> SELECT UPPER('Learning SQL is FUN!');
Result: 'LEARNING SQL IS FUN!'

mysql> SELECT UPPER('  SQL Tutorial  ');
Result: '  SQL TUTORIAL  '

Example 2:

Consider a database table called Employee with the following records:

EmpIDNameCityAgeSalary
1JohnLondon253000
2MarryNew York242750
3JoParis272800
4KimAmsterdam303100
5RameshNew Delhi283000
6HuangBeijing282800

The query given below is used to convert of column City to uppercase.

SELECT *, UPPER(City) AS City_Uppercase FROM Employee;

The query will produce the following result:

EmpIDNameCityAgeCity_Uppercase
1JohnLondon25LONDON
2MarryNew York24NEW YORK
3JoParis27PARIS
4KimAmsterdam30AMSTERDAM
5RameshNew Delhi28NEW DELHI
6HuangBeijing28BEIJING

❮ MySQL Functions