Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Simple text functions
How to modify strings
16. Function replace


Great! You can also replace certain parts of your string with anything you want. This is where we can use the function replace(x,y,z), which takes the string x and, if it finds the text y in the x, then y will be replaced with text z. Take a look:

SELECT replace('young man','young','old');

In the above example, the function will look for 'young' in the string 'young man' and will replace it with 'old'. As a result, we'll get 'old man'. Of course, you can provide a column name instead of 'young man' just as well.

Please note that the SQL standard does not contain the function replace we've just described. However, it's so popular among the available databases that we've decided to teach you how to use it.


For slogan with id = 1, show its original text and its text with the word 'Feel' replaced with 'Touch'.

Stuck? Here's a hint!

Use replace(text,'Feel','Touch').