Javatpoint Logo
Javatpoint Logo

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_Id Student_First_Name Student_Middle_Name Student_Last_Name Student_Class Student_City Student_State Student_Marks
4001 AMAN ROY SHARMA 4 CHANDIGARH PUNJAB 88
4002 VISHAL GURR SHARMA 8 MURTHAL HARYANA 95
4007 RAJ SINGHANIA GUPTA 6 GHAZIABAD UTTAR PRADESH 91
4004 YASH CHOPRA SINGHANIA 9 JAIPUR RAJASTHAN 85
4011 VINAY SHARMA ROY 8 CHANDIGARH PUNJAB 94
4006 MANOJ SINGHANIA GUPTA 5 GHAZIABAD UTTAR PRADESH 83
4010 RAM RAHEEM GUPTA 9 LUCKNOW UTTAR PRADESH 89

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_Name LOWER_LastName
SHARMA sharma
SHARMA sharma
GUPTA gupta
SINGHANIA singhania
ROY roy
GUPTA gupta
GUPTA gupta

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_Id LOWER(Student_First_Name) LOWER(Student_City) LOWER(Student_State)
4007 raj ghaziabad uttar pradesh
4004 yash jaipur rajasthan
4011 vinay chandigarh punjab
4006 manoj ghaziabad uttar pradesh
4010 ram lucknow uttar pradesh






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA