AppDividend
Latest Code Tutorials

SQL LOWER Function | Lower() Function In MySQL and SQL Server

0

Lower() Function Example In MySQL and SQL Server is today’s topic. The SQL LOWER function converts all the characters in a string into lowercase. If you want to convert all characters in a string into uppercase, you should use the UPPER function. SQL LOWER function is used for lowering the case of a string, i.e. all the characters in the specified string will be converted to lower case. This is one of the String functions.

SQL LOWER Function

See the following syntax.

SELECT LOWER (input_string)

PARAMETERS:

Input_string: It is the string whose characters are to be converted to lowercase. The input string can be any string or any table column.

NOTE:

If any number is given as an input, then it will remain unaffected.

Examples of LOWER() Function

Query 1

SELECT LOWER ('APPDIVIDEND.COM');

Output

appdividend.com

Query 2

SELECT LOWER ('AppDividend.com');

Output

appdividend.com

Query 3

SELECT LOWER ('SQL is FuN');

Output

sql is fun

Query 4

SELECT LOWER (‘ABC123DEF’);

Output

abc123def

As mentioned above, numerals are unaffected by the lower function.

Above were common examples to make you clear how this function works.

Let’s apply this to a table.

TABLE: (Employee)

Emp_id First_name Last_Name City State Phone
101 Rohit Raj Patna Bihar 8585145852
201 Shivam Kumar Jalandhar Punjab 8958458785
301 Karan Kumar Allahabad Uttar Pradesh 9987845784
401 Suraj Gupta Kolkata West Bengal 88789898980
501 Akash Jain Vizag Andhra Pradesh 98985475001

 

Let’s display the full name of the employee by converting all its characters to lowercase.

QUERY

SELECT First_name, Last_name, CONCAT_WS (' ', LOWER (First_name), LOWER (Last_name)) Full_name 
FROM Employee;

Output

First_name Last_Name Full_name
Rohit Raj rohit raj
Shivam Kumar shivam rana 
Karan Kumar   karan kumar
Suraj Gupta suraj gupta
Akash Jain akash jain

 

Here you can see that full_name is displayed under the column name Full_name whose characters are in lowercase.

The names are separated by a space using concat_ws function.

MySQL LOWER() Function

MySQL LOWER() converts all the characters in a string to lowercase characters.

Query

SELECT LOWER('APPDIVIDEND');

Output

+-----------------------+
| LOWER('MYTESTSTRING') |
+-----------------------+
| appdividend           | 
+-----------------------+

SQL Server LOWER() Function

The SQL LOWER() function converts all the characters in a string into lowercase.

Query

SELECT LOWER('KRUNAL LATHIYA');

Output

krunal lathiya
(1 row)

Finally, SQL LOWER Function | Lower() Function In MySQL and SQL Server Tutorial is over.

Recommended Posts

SQL AND OR NOT Operator Example Tutorial

NULL Functions in SQL Tutorial

Implement Error Handling in SQL

String Functions In SQL

Check Constraint In SQL

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.