LOWER Function in SQL

This string function shows all the characters and strings in the lower case in Structured Query Language. It converts the small character or set of small characters into capital letters.

We can also use the LOWER function with the string fields of the SQL table.

Syntax of LOWER String Function

Syntax1: This syntax uses the LOWER function with the column names of the SQL table:

In the syntax, we have to specify the column's name on which we want to use the LOWER string function.

Syntax2: This syntax uses the LOWER function with the set of upper case characters (string):

Syntax2: This syntax uses the LOWER function with the individual upper case character:

Examples of LOWER String function

Example 1: The following SELECT query converts all the characters of the following string in lower case:

Output:

javatpoint is a good website   

Example 2: The following SELECT query cannot change the characters of the following string because the LOWER function cannot change the symbols and integers of the string in SQL.

Output:

@#$12453@#   

Example 3: The following SELECT query converts the capital letters into small letters:

Output:

new delhi is the capital of india   

Example 4: The following SELECT query shows the character 'S' in lower-case in the output:

Output:

s  

Example 5: This example uses the LOWER function with the SQL table

In this example, we are going to create a new table whose string columns will contain upper-case characters.

The syntax for creating the new SQL table is mentioned in the below block:

The following CREATE statement creates the Student_Marks table:

The below INSERT queries insert the records of college Faculties in the Student_Marks table:

The following SELECT statement displays the inserted records of the above Student_Marks table:


Student_IdStudent_First_NameStudent_Middle_NameStudent_Last_NameStudent_ClassStudent_CityStudent_StateStudent_Marks
4001AMANROYSHARMA4CHANDIGARHPUNJAB88
4002VISHALGURRSHARMA8MURTHALHARYANA95
4007RAJSINGHANIAGUPTA6GHAZIABADUTTAR PRADESH91
4004YASHCHOPRASINGHANIA9JAIPURRAJASTHAN85
4011VINAYSHARMAROY8CHANDIGARHPUNJAB94
4006MANOJSINGHANIAGUPTA5GHAZIABADUTTAR PRADESH83
4010RAMRAHEEMGUPTA9LUCKNOWUTTAR PRADESH89

The following SELECT query uses the LOWER function with the Student_Last_Name column of the above Student_Marks table:

This SQL statement converts the last name in lower case of each student from the above table.

Output:

Student_Last_NameLOWER_LastName
SHARMAsharma
SHARMAsharma
GUPTAgupta
SINGHANIAsinghania
ROYroy
GUPTAgupta
GUPTAgupta

The following SELECT query uses the LOWER function with the Student_First_Name, Student_City, and Student_State columns of those students whose Student_Id is greater than 4002 in the above Student_Marks table:

Output:


Student_IdLOWER(Student_First_Name)LOWER(Student_City)LOWER(Student_State)
4007rajghaziabaduttar pradesh
4004yashjaipurrajasthan
4011vinaychandigarhpunjab
4006manojghaziabaduttar pradesh
4010ramlucknowuttar pradesh





Latest Courses