Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete specific values from column with where condition?

I want to delete specific values/data from one column with the WHERE condition. Putting in another way, I don't want to delete the complete row. Is it possible?

like image 421
tina Avatar asked Jan 19 '11 07:01

tina


People also ask

Can you write delete query with WHERE condition?

You can use the WHERE clause with a DELETE query to delete the selected rows, otherwise all the records would be deleted.

How do I delete a specific row value in SQL?

To remove one or more rows in a table: First, you specify the table name where you want to remove data in the DELETE FROM clause. Second, you put a condition in the WHERE clause to specify which rows to remove. If you omit the WHERE clause, the statement will remove all rows in the table.

How do I delete with condition?

Example - DELETE Statement with more than One ConditionThe AND condition allows you to delete a record if all of the conditions are met. The OR condition deletes a record if any one of the conditions are met. Let's look at an example of how to use the DELETE statement with two conditions using the AND condition.


2 Answers

UPDATE YourTable SET columnName = null WHERE YourCondition 
like image 73
BvdVen Avatar answered Sep 21 '22 12:09

BvdVen


UPDATE myTable     SET myColumn = NULL   WHERE myCondition 
like image 43
JonBaron Avatar answered Sep 22 '22 12:09

JonBaron