The LOWER() function returns a given string, an expression, or values in a column in all lowercase letters. The syntax of the function is illustrated below:
Copy
Ask AI
LOWER(string)
It accepts input as a string and returns the text in the lowercase alphabet.Special Cases: If there are characters in the input which are not of type string, they remain unaffected by the LOWER()function.
We support Unicode so that the ß is equivalent to the string ss.
Let’s see how the LOWER() function works using an example with columns. We have a personal_details table containing columns id, first_name, last_name, and gender of retail store employees.
+-----+-------------+-------------+----------+| id | first_name | last_name | gender |+-----+-------------+-------------+----------+| 1 | Mark | Wheeler | M || 2 | Tom | Hanks | M || 3 | Jane | Hopper | F || 4 | Emily | Byers | F || 5 | Lucas | Sinclair | M |+-----+-------------+-------------+----------+
Let’s assume that we want to convert the first and last names of employees with id numbers 2, 4, and 5 to all lowercase letters, which can be done using the following query:
Copy
Ask AI
SELECT first_name,last_name,LOWER(first_name),LOWER(last_name)FROM personal_detailswhere id in (2, 4, 5);
The output displays the first and last names of employees with the specified ids in lowercase letters:
Copy
Ask AI
+------------+-------------+----------+----------+| first_name | last_name | lower | lower |+------------+-------------+----------+----------+| Tom | Hanks | tom | hanks || Emily | Byers | emily | byers || Lucas | Sinclair | lucas | lucas |+------------+-------------+----------+----------+