MySQL Query needed: I need to delete all data from a single column

This will set every product_url to NULL which is currently not null.

UPDATE table_name
SET product_url = NULL
WHERE product_url is not null;

First of all, if you have 300 tables (one for each product), you cannot write one query that will set product URLs to NULL.

You have to write a query for each table (UPDATE table_name SET product_url = NULL as others have already said).

And if you have 10,000 products one day, you will have 10,000 tables if you continue like this. This will become a maintenance nightmare since you can see now what kind of problems you have with 300 tables.

Your database is denormalised. If your products share the same attributes, then they should be in one table named "Products", and every product should be represented as one row. Only then can you do what you wanted with one query.

Tags:

Mysql