JMeterX
JMeterX

Reputation: 438

Update all columns with the value of NULL

I have a very simple table let's call it Samsung. In this table I have a column called description with two values with samsung_id of 200 & 201. For these two entries, I have a value for description of "NULL." I want to be able to update all of these. I know I can run the following comand:

UPDATE SAMSUNG
SET description = 'square'
WHERE samsung_id = 200 OR samsung_id = 201;

To achieve my desired results, but what if your table had 1,000 entries and you didn't want to list them out. How would you run this command to take out all the values of NULL and replace with square.

Upvotes: 0

Views: 2011

Answers (2)

ljh
ljh

Reputation: 2594


UPDATE SAMSUNG
SET description = 'square'
WHERE description IS NULL or description = 'NULL'
In case you save a string value 'NULL' in your description.

Upvotes: 2

rbedger
rbedger

Reputation: 1235

UPDATE SAMSUNG
SET description = 'square'
WHERE description IS NULL

Upvotes: 6

Related Questions