Question:

Consider the string "Informatics Practices". Write suitable SQL queries for the following :
(i) To convert the entire string to uppercase.
(ii) To display the total number of characters in the given string.

Show Hint

UPPER() changes text to uppercase; LENGTH() counts all characters including spaces and symbols.
Updated On: Jul 14, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

To handle string operations in SQL, we use built-in string functions.
For the given string "Informatics Practices", the following queries can be used:
1. To convert the entire string to uppercase, we use the UPPER() function.
The query will be:
SELECT UPPER('Informatics Practices');
This will return the result as "INFORMATICS PRACTICES".
The UPPER() function is useful when you want to standardize text data for comparison or display.
2. To count the total number of characters in the string, we use the LENGTH() function.
The query will be:
SELECT LENGTH('Informatics Practices');
This will return 21 because the string has 21 characters including the space.
The LENGTH() function helps to validate input data, check string sizes, and perform text analysis in databases.
Together, these functions help manage and process text data effectively in SQL.
Was this answer helpful?
0
0

Top Questions on SQL Queries

View More Questions

Questions Asked in CBSE CLASS XII exam

View More Questions