I have an ecommerce store that I am currently working on and there are approx 300 products which have a field named "product_url"
These fields contains an old url that I need to delete altogether.
How can I create a query that will replace all "product_url" fields with data in them witha null value?
Syntax. The syntax to drop a column in a table in MySQL (using the ALTER TABLE statement) is: ALTER TABLE table_name DROP COLUMN column_name; table_name.
Deleting a MySQL or MariaDB database First list all databases on your server. Use the command 'SHOW DATABASES;' in the mysql-console like in the example above. Now copy the name of the database you want to delete. To do delete a database you need the command 'DROP DATABASE'.
The MySQL DELETE Statement The DELETE statement is used to delete existing records in a table.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With