MySQL UPPER() function

UPPER() function

MySQL UPPER() converts all the characters in a string to uppercase characters.

This function is useful in -

  • Uppercase conversion: It allows you to convert a string to uppercase
  • Case-insensitive comparison: UPPER() can be used for case-insensitive string comparison.
  • Data normalization: UPPER() is often used in data normalization tasks to convert strings to a consistent case.


UPPER (string)


Name Description
string A string whose characters are to be converted to uppercase.

Syntax Diagram:

MySQL UPPER() Function - Syntax Diagram

MySQL Version: 8.0

Example : MySQL UPPER() function

The following MySQL statement returns the given string after converting all of its characters in uppercase.


SELECT UPPER('myteststring');


mysql> SELECT UPPER('myteststring');
| UPPER('myteststring') |
| MYTESTSTRING          | 
1 row in set (0.00 sec)

Example of MySQL UPPER() function with where clause

The following MySQL statement returns those rows from the publisher table whose publishers are not belonging the country USA. The column pub_name, and values of publisher names in uppercase have been shown in the output.


SELECT pub_name,UPPER(pub_name) 
FROM publisher 
WHERE country<>'USA'; 

Sample table: publisher


mysql> SELECT pub_name,UPPER(pub_name) 
    -> FROM publisher 
    -> WHERE country<>'USA';
| pub_name                     | UPPER(pub_name)              |
| BPP Publication              | BPP PUBLICATION              | 
| New Harrold Publication      | NEW HARROLD PUBLICATION      | 
| Ultra Press Inc.             | ULTRA PRESS INC.             | 
| Pieterson Grp. of Publishers | PIETERSON GRP. OF PUBLISHERS | 
| Novel Publisher Ltd.         | NOVEL PUBLISHER LTD.         | 
5 rows in set (0.11 sec)

All String Functions (Slides presentation)

Previous: UNHEX
Next: MySQL Mathematical functions ABS()

Follow us on Facebook and Twitter for latest update.