How to Use SQL Query for Case Sensitive Data in Magento 2

Ever had to deal with postcodes in Magento 2 store for managing the shipping charges?

Is your business charging shipping rates in Magento 2 store based on the location of delivery?

If yes, you might have to juggle between the postcodes assigned to the shipping rules and the values entered by the frontend user in your store. Magento assigns the shipping charges by matching the postcode and the shipping rule configured.

However, if there is a variation in postcodes, for example, uppercase and lowercase, there are chances of errors in the calculation.

The solution to avoid it is to use SQL query for case sensitive data in Magento 2. Use the below method to differentiate the postcode with uppercase or lowercase and accordingly charge the shipping rates!

You can use this method where you want to differentiate values based on the case sensitivity.

Method to Use SQL Query for Case Sensitive Data in Magento 2:

Dataset:

Table Name: Custom

No.PostCode
1GL1
2Gl1
When you run the above query, you’ll get the below output:

No Postcode
1 GL1

That’s it.

Any doubts about the above method can be mentioned in the Comments section below. I’d be glad to help you out.

Also, do share the post with the Magento Community via social media.

Thank you.

5
(based on 5 Reviews)
How to Use SQL Query for Case Sensitive Data in Magento 2

Kanchi Upadhyay

Kanchi is a Magento Developer at Meetanshi. Apart from that, she is into dancing. In her free time, she likes to make handmade art and craft.

Leave a Reply

Your email address will not be published. Required fields are marked *