EDUCBA

EDUCBA

MENUMENU
  • Blog
  • Free Courses
  • All Courses
  • All in One Bundle
  • Login
Home Data Science Data Science Tutorials MySQL Tutorial MySQL LOWERCASE

MySQL LOWERCASE

MySQL LOWERCASE

Introduction to MySQL LOWERCASE

The following article provides an outline for MySQL LOWERCASE. To convert the string to lowercase, we can do it by using the LOWERCASE function. The LOWERCASE has one argument which will accept the string and convert it into the lower case. The function used for the above functionality is LOWER() or LCASE(). Binary, BLOB, and Varbinary are binary string data; these are ineffective when applied to the LOWER() function. To pass such data, we first convert the string to a non-binary string.

Syntax:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

The syntax for the LOWERCASE function is as below:

LOWER( <string> / <column_name> )

Or

LCASE (<string> / <column_name>)

How does MySQL LOWERCASE work?

Now let’s see how the LOWER() function works individually and in the table:

Code:

SELECT LOWER ( 'HI . . . WORLD' ) AS MESSAGE;

Here we can see that the <string> is mentioned as “HI . . . WORLD”. Above, we use the LOWER function to convert the ‘upper string’ to the ‘lower string’.

Output:

'HI . . . WORLD'

Code:

SELECT LCASE( 'HI . . . WORLD' ) AS MESSAGE;

Here we can see that the <string> is mentioned as “HI . . . WORLD”. Above, we use the LCASE function to convert the ‘upper string’ to the ‘lower string’.

Output:

MySQL LOWERCASE 2

Now let us create a table and apply the LOWER () function:

Code:

CREATE TABLE LOWERCASE_DEMO (
ID INT,
UPPERCASE_VALUE VARCHAR(15)
);

Now let us insert data into the table:

Code:

INSERT INTO LOWERCASE_DEMO VALUES ( 1, 'BE INDEPENDENT');
INSERT INTO LOWERCASE_DEMO VALUES ( 2, 'BE CONFIDENT');
INSERT INTO LOWERCASE_DEMO VALUES ( 3, 'BE YOU');
INSERT INTO LOWERCASE_DEMO VALUES ( 4, 'BE POSITIVE');
INSERT INTO LOWERCASE_DEMO VALUES ( 5, 'BE REAL');
INSERT INTO LOWERCASE_DEMO VALUES ( 6, 'BE KIND');
INSERT INTO LOWERCASE_DEMO VALUES ( 7, 'BE GENEROUS');
INSERT INTO LOWERCASE_DEMO VALUES ( 8, 'BE FAMOUS');
INSERT INTO LOWERCASE_DEMO VALUES ( 9, 'YOU GOT THIS !!');

Now let us select the data from the table without applying the LOWER function. The output would be as below—screenshot for the same. Here we can see that the column ‘UPPERCASE_VALUE’ data is in upper case. We use the LOWER and LCASE functions to convert the characters into the LOWER cases.

Code:

select * from LOWERCASE_DEMO;

Output:

MySQL LOWERCASE 3

Now let us see the LOWER function and LCASE function:

Code:

SELECT *, LOWER ( UPPERCASE_VALUE) AS LOWER_VALUE,
LCASE ( UPPERCASE_VALUE) AS LCASE_VALUE FROM LOWERCASE_DEMO;

In the above select statement, we could see that instead of ‘string expression’, we have specified the ‘column name.’ Which will convert the column values from upper case to lower case as below. The LOWER function or LCASE function achieves this.

Output:

MySQL LOWERCASE 4

Examples of MySQL LOWERCASE

Given below are the examples of MySQL LOWERCASE:

Example #1

Now let us see how the LOWER () function works individually and in the table.

Multiple cases in one string output also give lower case using the LOWER function.

Code:

SELECT LOWER( 'Hi . . . world QwErTy' ) AS MESSAGE;

Here we can see that the <string> is mentioned as ‘Hi . . . world QwErTy’, which is a combination of upper case and lower case. Once we use the LOWER function to convert the ‘upper string’ to ‘lower string’. The lower characters will convert to upper case, while the upper case characters will remain as they are.

Output:

Multiple case in one string

Code:

SELECT LCASE ( 'Hi . . . world QwErTy' ) AS MESSAGE;

Here we can see that the <string> is mentioned as ‘Hi . . . world QwErTy’, which is a combination of upper case and lower case. Once we use the LCASE function to convert the ‘upper string’ to ‘lower string,’. The lower characters will be converted to upper, and the upper case remains upper.

Output:

Hi . . . world QwErTy'

Example #2

Let us see another example for the LOWER and LCASE functions below.

Code:

CREATE TABLE COLLEGEDATA
(
COLLEGE_ID INT,
COLLEGE_NAME VARCHAR(50),
NO_OF_STUDENTS INT,
LOCATION VARCHAR(20)
);

The below data is inserted into the above table:

Code:

INSERT INTO COLLEGEDATA VALUES (1890, 'Narayana pvt college', 700000, 'Hyderabad');
INSERT INTO COLLEGEDATA VALUES (2890, 'St.Josephpvt college', 560000, 'Kerala');
INSERT INTO COLLEGEDATA VALUES (3890, 'Private Plan pvt college', 230000, 'Hyderabad');
INSERT INTO COLLEGEDATA VALUES (4890, 'Chorniclepvt college', 60000, 'Maharastra');
INSERT INTO COLLEGEDATA VALUES (5890, 'Number one pvt college', 780000, 'Hyderabad');
INSERT INTO COLLEGEDATA VALUES (6890, 'Startuppvt college', 500000, 'Uttar Pradesh');

Select the data from the above table, and the rows look as below:

Code:

SELECT * FROM COLLEGEDATA;

Now let us select the data from the table without applying the LOWER function.

Output:

MySQL LOWERCASE 8

Let us apply the LOWER and LCASE functions:

Code:

SELECT COLLEGE_NAME,LOWER(COLLEGE_NAME),LCASE(COLLEGE_NAME)
,LOCATION , LOWER(LOCATION) , LCASE(LOCATION)  FROM COLLEGEDATA;

Here we can see that the column ‘COLUMN_NAME’ data is in upper case. We use the LOWER and LCASE functions to convert the characters into the LOWER issues.

Output:

MySQL LOWERCASE 9

Conclusion

To convert the string to lowercase, we can do it by using the LOWER CASE function. The LOWERCASE has one argument which will accept the string and convert it into the lower case. The function used for the above functionality is LOWER () or LCASE (). Binary, BLOB, and VARBINARY are types of binary string data. However, applying the LOWER() function to these data types is ineffective. To pass such data, we first convert the string to a non-binary string.

Recommended Articles

We hope that this EDUCBA information on “MySQL LOWERCASE” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. MySQL BIT
  2. Delete Database MySQL
  3. MySQL REGEXP
  4. mysql_real_escape_string
All in One Excel VBA Bundle
500+ Hours of HD Videos
15 Learning Paths
120+ Courses
Verifiable Certificate of Completion
Lifetime Access
Financial Analyst Masters Training Program
1000+ Hours of HD Videos
43 Learning Paths
250+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Data Science Bundle
1500+ Hour of HD Videos
80 Learning Paths
360+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Software Development Bundle
3000+ Hours of HD Videos
149 Learning Paths
600+ Courses
Verifiable Certificate of Completion
Lifetime Access
Primary Sidebar
All in One Data Science Bundle1500+ Hour of HD Videos | 80 Learning Paths | 360+ Courses | Verifiable Certificate of Completion | Lifetime Access
Financial Analyst Masters Training Program1000+ Hours of HD Videos | 43 Learning Paths | 250+ Courses | Verifiable Certificate of Completion | Lifetime Access
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more