How to Use SQL Upper Function
Earlier, I posted the solution to copy one column to another in SQL.
Now, what if one wants to change the column to uppercase in the database table?
Well, there’s UPPER() function that you can use directly to change the column to uppercase.
The upper() function converts all the letters in a string into uppercase.
For example, you have an online store where customers fill the form to sign up. As everyone is not the same, some of the mandatory fields like email addresses or country name may have a variety of inputs.
However, when you are managing the customer data from the database, you want all the email addresses in lower case or the country name in uppercase.
Doing it manually does not make sense, but you can use the SQL upper() function to change the column to uppercase!
The below example shows how to use SQL uppercase in the database.
Use of SQL Upper function:
Example: Change the column values to uppercase
1 |
UPDATE indiacity SET city = UPPER(city); |
Using this query, you can change the column values to upper case.
If you have any doubts about the solution, please mention them in the Comments section below. I’d be glad to help you out.
Also, do not forget to share it using social media.
Thank you.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
Prev
How To Create Virtual Products in Magento 2
How to Upload Placeholder in Magento 2
Next