SQL – Converting Strings to Upper & Lower-Case

In order to convert character or string columns in SQL to UPPER or LOWER case we need to know the proper SQL functions. Easily enough, the ANSI-SQL functions for providing upper and lower-case values are UPPER() and LOWER().

Upper-Case SQL Syntax

SELECT UPPER(<column_name>) AS ColumnName FROM Table;

Lower-Case SQL Syntax

SELECT LOWER(<column_name>) AS ColumnName FROM Table;

These functions can be used across most databases as a result of being ANSI-Standard SQL. As a result, these functions can also be used in conjunction with other functions. Just be sure for every open parentheses to include closed parentheses.

Practical Examples of Changing to Upper/Lower-Case

We can look at practical examples to view how we can actually use and write the SQL. We can also use these functions on multiple columns as shown in the example below.

SQL Upper Lower Case Syntax Example
Upper & Lower-Case Examples
sql multiple columns upper case
Upper-case Multiple Columns

We can see the resulting output with both columns with upper-case letters.

sql upper case results
Final Thoughts & Camel-Case

Using UPPER and LOWER functions in SQL are fairly straight-forward. However, there are also other ways to compliment these functions. We can use functions like SUBSTRING() or SUBSTR() to upper-case the first letter and lower-case the rest. Combining substring and the upper/lower functions will accomplish most case sensitivity cases in SQL. Some databases include their own functions to accomplish other case sensitivity options so refer to those specific database documents.

RELATED: SQL Concatenate – Combining Multiple Columns