At least as I know it, INSERT goes like: INSERT INTO table (Col1, Col2) VALUES('Hello', 'Goodbye') Code (markup): While UPDATE goes like: UPDATE table SET Col1 = 'Hello', Col2 = 'Goodbye' Code (markup): Is there any way I could make them the same format, such as: UPDATE table (Col1, Col2) VALUES('Hello', 'Goodbye') Code (markup): ? Thanks!
hmm it looks like I can use SET with INSERT I wonder why I NEVER see this though? I always see the VALUES() method...
values is the easier method because you don't have to explicitly name all of the fields you are inserting into, just as long as you insert them in the same order they are defined in the table.
If you're using mysql you can use REPLACE INTO with the exact same syntax as INSERT INTO. It will update the record if the primary key matches, or insert a new record if it does not.