Back
In MySQL, I have a column containing URLs (id, url):
http://www.example.com/articles/updates/43 http://www.example.com/articles/updates/866 http://www.example.com/articles/updates/323 http://www.example.com/articles/updates/seo-url http://www.example.com/articles/updates/4?something=test
I need to modify the word "updates" to "news". Will it possible to do this with a script?
You can use the below code:
UPDATE your_table SET your_field = REPLACE(your_field, 'articles/updates/', 'articles/news/') WHERE your_field LIKE '%articles/updates/%'
Now rows that were like
http://www.example.com/articles/updates/43
Will be
http://www.example.com/articles/news/43
Want to become a SQL Expertise? You can register to this SQL Course and get certified.
30.9k questions
32.9k answers
500 comments
665 users