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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
UPDATE TABLE SET columnName = null WHERE YourCondition
回答2:
You don't want to delete if you're wanting to leave the row itself intact. You want to update the row, and change the column value.
The general form for this would be an UPDATE
statement:
UPDATE <table name>
SET
ColumnA = <NULL, or '', or whatever else is suitable for the new value for the column>
WHERE
ColumnA = <bad value> /* or any other search conditions */
回答3:
UPDATE myTable
SET myColumn = NULL
WHERE myCondition
回答4:
You can also use REPLACE().
UPDATE Table SET Column = REPLACE(Column, 'Test123', 'Test')