Marek Marek - 1 year ago 65
MySQL Question

Delete URLs with specific domains from MySQL database

I have URLs in column URL. I would like to delete all URLs from database with selected domains. In database are different domains. Do I need to use regex?
For example, I have urls:

https://example.com/something/gnsgngdf
https://example.com/?%jgfingi
https://anotherdomain.net/?gdtfhj65
etc.


I would like to write one SQL expression to delete all URLs that begin with selected domain. Something like this:

DELETE FROM table WHERE url = regex: https://example.com

Answer Source

In this case, you could use a simple like

 DELETE FROM table WHERE url  liKe 'https://example.com%'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download