Assume you have a FRUIT table in your database. It has a column COUNTRIES containing a comma separated string of country names to indicate where you have business of trading this fruit. Now, you are going to trade Mango with a new country, Ruddo, and for some reason, to stop trading Mango with Gutta, you need to update the COUNTRIES value of the Mango record in your FRUIT table to add Ruddo and remove Gutta.
Instead of retyping the whole string, you can use the SQL below to replace Gutta by Ruddo.
Update FRUIT
Set Countries = REPLACE(Countries, "Gutta", "Ruddo")
WHERE FruitName = 'Mango';
---------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
Instead of retyping the whole string, you can use the SQL below to replace Gutta by Ruddo.
Update FRUIT
Set Countries = REPLACE(Countries, "Gutta", "Ruddo")
WHERE FruitName = 'Mango';
---------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
No comments:
Post a Comment