Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

INSERT vs. UPDATE for column data

Can I use UPDATE if the column value is NULL?



5:48 pm on Jun 13, 2008 (gmt 0)

5+ Year Member


I'm wondering if it's possible to use UPDATE on a row where it's unknown whether the column being updated already has a value or not.

If the column's value is set to NULL, will UPDATE work? Or do I really need to test for NULL and write either an UPDATE or an INSERT query? I'd really like to streamline my code by not having to do the test, but I don't know how far UPDATE will go.

By the way, I looked at REPLACE INTO, but I'm not worried about an entire row of data, just a single column in an existing row.



8:26 am on Jun 14, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

INSERT inserts a new ROW.
UPDATE modifies an existing row's VALUE(s).


7:55 pm on Jun 14, 2008 (gmt 0)

5+ Year Member

Thanks. Of course you're right. That clears things up for me. UPDATE it is!

Featured Threads

Hot Threads This Week

Hot Threads This Month