What is meant by case manipulation functions? Explains its different types in SQL

Asked: Apr 14, 2023

Case manipulation functions are part of the character functions. It converts the data from the state in which it is already stored in the table to upper, lower, or mixed case. The conversion performed by this function can be used to format the output. We can use it in almost every part of the SQL statement. Case manipulation functions are mostly used when you need to search for data, and you don't have any idea that the data you are looking for is in lower case or upper case.

There are three case manipulation functions in SQL:

LOWER: This function is used to converts a given character into lowercase. The following example will return the 'STEPHEN' as 'stephen':

  1. SELECT LOWER ('STEPHEN') AS Case_Reault FROM dual;

NOTE: Here, 'dual' is a dummy table.

UPPER: This function is used to converts a given character into uppercase. The following example will return the 'stephen' as 'STEPHEN':

  1. SELECT UPPER ('stephen') AS Case_Reault FROM dual;

INITCAP: This function is used to converts given character values to uppercase for the initials of each word. It means every first letter of the word is converted into uppercase, and the rest is in lower case. The following example will return the 'hello stephen' as 'Hello Stephen':

  1. SELECT INITCAP ('hello stephen') AS Case_Reault FROM dual;
Asked by brijesh

Answers (0)

No answers yet. Be the first to answer!