UPPER() in SQL
Converts all characters in a string to uppercase letters.
Syntax
Return type
UPPER() Function Example
What is UPPER() in SQL?
The UPPER()
function in SQL is used to convert all characters in a given string to uppercase. This function is particularly useful when performing case-insensitive comparisons, standardizing text formatting, or ensuring uniformity in stored data. It is supported in various database systems, including MySQL, PostgreSQL, SQL Server, and SQLite. The UPPER()
function does not modify the original data but returns a new string with all letters capitalized. It is commonly used in SELECT queries to format output dynamically or match case-sensitive values consistently across datasets.
Parameters:
string: The input string or column to be converted to uppercase
Example Use Cases:
-- Standardize company names
-- Case-insensitive search
-- Consistent display format
Notes:
Behavior: Converts all alphabetic characters to uppercase; numbers and special characters remain unchanged
Performance Considerations: Minimal impact on performance, suitable for large-scale operations
Version Info: Core SQL function, available in all major DBMS versions
Error Handling:
Error: Generally doesn't throw errors, returns NULL for NULL input
Supported Databases:
DBMS
Function / Syntax
Example
Behavior with NULL
MySQL
UPPER()
UPPER('hello')
Returns NULL
PostgreSQL
UPPER()
UPPER('hello')
Returns NULL
SQL Server
UPPER()
UPPER('hello')
Returns NULL
SQLite
UPPER()
UPPER('hello')
Returns NULL
BigQuery
UPPER()
UPPER('hello')
Returns NULL
Snowflake
UPPER()
UPPER('hello')
Returns NULL
Athena
UPPER()
UPPER('hello')
Returns NULL