Home » SQL

Use of UCASE(), LCASE() and MID() functions in SQL

In this article, we are going to discuss about the use of Upper Case, Lower Case and Mid function in SQL.
Submitted by Bharti Parmar, on January 30, 2019

Upper Case, Lower Case and MID functions are scalar functions which return a single value, based in the input value.

As you all know sometimes different databases have not more but, have some minor changes in their syntax's. Similarly, for convert a field value to the upper case, lower case and for MID value different syntax are there for the different database:

Table: Let, we have a table name STUDENT

Table example for ucase, lcase and mid functions

1) UCASE() function

This function is used to converts a field value to upper case.


SELECT UCASE(column_name) FROM table_name;
SELECT UPPER(column_name) FROM table_name;


UCASE() function example in SQL

2) LCASE() function

This function is used to converts a field value to lower case.


SELECT LCASE(column_name) FROM table_name;
SELECT LOWER(column_name) FROM table_name;


LCASE() function example in SQL

3) MID() function

This function is used to extract the char from a text field.


SELECT MID(column_name,start,length) AS some_name FROM table_name;

column_name, start, length are the required parameters in MID() function. It is used to extract values of a field.


  • column_name - is used to extract char.
  • start - shows the starting point like 0 or 1.
  • length - is to return the number of character.


SUBSTRING() function is also used to extract MID() value. Basically, this SUBSTRING() function is used in SQL Server.


SELECT SUBSTRING(column_name,start,length) AS name FROM table_name;


In this article, we have learned how to use UCASE(), LCASE() and MID() functions in SQL and SQL queries? We will know more about different or use of another scalar function in SQL. Have a great day! Happy Learning!


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.