Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I have a table with the following columns in a MySQL database

[id, url]

And the urls are like:

 http: //domain1.com/images/img1.jpg

I want to update all the urls to another domain

http: //domain2.com/otherfolder/img1.jpg

keeping the name of the file as is.

What's the query must I run?

1 Answer

0 votes
by (40.7k points)

Use the code mentioned below:

Query:

UPDATE urls

SET url = REPLACE (url,'domain1.com/images/','domain2.com/otherfolder/')

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 18, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

Browse Categories

...