SQL LOWER Function | Convert a String Into SQL Lowercase

SQL Lowercase Function Summary: In this article, you will learn What is SQL Server LOWER() function and How to use the SQL LOWER function to convert all characters of a string into the SQL lowercase.

Definition and Usage

The LOWER() function converts all the characters in a string into lowercase. suppose that if you want to convert all characters in a string into uppercase, then you should use the SQL UPPER function.

In another way, you can say that in SQL Server, you can convert any uppercase string to lowercase by using the SQL LOWER() function.

Therefore, just simply provide the string as an argument when you call the function, and it will be returned in lowercase form.

SQL Lowercase Function Syntax

The following syntax shows the LENGTH() function:

LOWER(input_string)

In this syntax:

  • Required. the input_string in this syntax can be a literal character string, character string expression, variable, or table column.

    The type of the input_string must be implicitly convertible to VARCHAR. Otherwise, you must use the CAST() function to convert the input_string explicitly.

.
Note:Important Note: Therefore, in some database systems like as Oracle database and MySQL provide the LCASE function which is equivalent to the LOWER function.
The LOWER() function returns a string with all characters in the lowercase format. if the input string is NULL then its returns NULL.

SQL Server LOWER Function Examples

Let’s take few examples of using the LOWER() function.

A) Using SQL LOWER() function with the literal strings

The following statement uses the SQL Server LOWER function to convert a string to lowercase:

B) Using SQL LOWERCASE function with table column

The following given below Persons table to used for demonstration.

PersonID Name Address City
1 Noah Elijah Bridgetown Barbados
2 William Josiah Brussels Belgium
3 Elijah Connor Zagreb Croatia
4 Benjamin Hunter San Jose Costa Rica
5 Alexander Landon Roseau Dominica
6 Jacob Jonathan Paris France
7 Daniel Jeremiah Libreville Gabon
8 Owen Dominic Athens Greece
9 Gabriel Roman Tegucigalpa Honduras
10 Mateo Ezekiel Budapest Hungary

The following statement uses the SQL LOWER() function to convert the Name and Address of persons to lowercase before concatenation.


SQL lowercase

C) Using sql Lowercase function to querying data case insensitive

Therefore the literal string “Alexander Landon” is different from the “alexander landon” when it comes to an input for a query because of SQL performing the operation such as case-sensitive.

To query data case-insensitive, then you can use the SQL LOWER() function.

However, when you use the SQL Server LOWER function, it returns a row.


lowercase SQL

Conclusion

In this tutorial, you have learned What is SQL Server LOWER() function and How to use this function with different conditions to convert all characters of a string into SQL lowercase. I hope you will enjoy! if have any query, contact me, I have try to resolve the problem.