Update examples

Update examples.

Last updated:

Warning: Review and test in a non-production environment before running.

Back to results

Update the column "column_name" with the value ‘value’. this will update all records in table.
UPDATE table_name SET column_name = ‘value’;

Update the column "col" with the value ‘val1’ only when "col2" is equal to ‘val2’. 
UPDATE table SET col = ‘val1’ WHERE col2 = ‘val2’;

Update two columns "col1" and "col2" only when "col5" is equal to ‘val5’.
UPDATE table SET col1 = ‘val1’, col2 = ‘val2’ WHERE col5 = ‘val5’;

Update the column "phone" only to id "23998".
UPDATE customers SET phone = '036697845' WHERE id = '23998';