Reputation: 149
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
Upvotes: 2
Views: 589
Reputation: 133360
In this case, you could use a simple like
DELETE FROM table WHERE url liKe 'https://example.com%'
Upvotes: 3
Reputation: 3018
DELETE FROM table WHERE url like 'https://example.com%'
No need for a regex. You can use the like operator. Now everything is deleted which starts with this URL.
Upvotes: 0
Reputation: 151
DELETE FROM tablename WHERE url like 'https://example.com%'
do not forget the %
Upvotes: 1