Refresh column value for all rows of a table, where column value is Null?

We continue to study SQL-Fu and try to figure out how to make a simple update in my table (for example, [TABLE1]), where all the rows with the column value [COST] NULLare updated to [COST]value 0.00.

Can someone show me how this is done correctly? I found examples of how to update the value of EVERY row for a column, but could not fully compose the WHERE clause.

+4
source share
1 answer

You can check the NULL value in a column using IS NULL.

UPDATE Table1
    SET cost = 0
    WHERE cost IS NULL;
+10
source

Source: https://habr.com/ru/post/1620592/


All Articles