×
☰ See All Chapters

MySQL UPPER and LOWER Function

MySQL UPPER function accepts a string argument and returns the uppercase version of that string. This function does not affect any of the special characters, digits, and the alphabets that are already in the upper case.

MySQL LOWER function accepts a string argument and returns the lowercase version of that string. This function does not affect any of the special characters, digits, and the alphabets that are already in the lower case.

MySQL UPPER and LOWER Function Syntax

UPPER(arg)

LOWER(arg)

arg is the argument that you want to convert to the lowercase or lower case. This can be an expression or a direct value or a value from a column of any type.

MySQL UPPER and LOWER Function Example

Creating table for demonstrating UPPER and LOWER Function

CREATE TABLE NAME

(

  FNAME  VARCHAR(10 )    NOT NULL,

  LNAME  VARCHAR(10 )

);

Insert into NAME (FNAME, LNAME) Values ('ADI', 'TEMP');

Insert into NAME (FNAME, LNAME) Values ('NAVEEN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('HARISH', 'GOWDA');

Insert into NAME (FNAME, LNAME) Values ('HARI', 'PRASAD');

Insert into NAME (FNAME, LNAME) Values ('ARJUN', 'SHETTY');

Insert into NAME (FNAME, LNAME) Values ('KIRAN', 'KUMAR');

COMMIT;

Example 1

SELECT UPPER(FNAME),LOWER(LNAME)

FROM NAME

mysql-upper-and-lower-function-0

Example 2

SELECT UPPER('abcd'),LOWER('EFGH')

FROM NAME

mysql-upper-and-lower-function-1


All Chapters
Author