avatar
delete rows containing specific value in column MySQL

Let us assume we have an example schema for the URLs table as follows:

{
  "table": "urls",
  "columns": [
    {
      "name": "id",
      "data_type": "Integer",
      "description": "Primary key, unique identifier"
    },
    {
      "name": "loc",
      "data_type": "Text",
      "description": "URL of the website"
    }
  ]
}

Here is an example JSON structure representing data for the URLs table:

[
  {
    "id": 1,
    "loc": "https://www.example.com"
  },
  {
    "id": 2,
    "loc": "https://www.google.com"
  },
  {
    "id": 3,
    "loc": "https://www.flagtickgroup.com"
  },
  {
    "id": 4,
    "loc": "https://www.yahoo.com"
  }
]

Use the DELETE statement along with the LIKE operator to match any records where the loc column contains the specified substring flagtickgroup.com.

DELETE FROM fla_urls WHERE loc LIKE '%flagtickgroup.com%';
You need to login to do this manipulation!