update value mysql code example

Example 1: mysql update query

UPDATE table_name SET field1 = 'value 1', field2 = 'value 2'
WHERE field3 = 'value 3'

Example 2: update set mysql

UPDATE tableName SET anAttribute = 'Something' WHERE anOtherAttribute = 'SomethingElse'

//All 'SomethingElse' values will become 'Something'

Example 3: update query in mysql

-- Set New Employee Password 
UPDATE employee
SET employee.password = '1234'
WHERE employee.email = '[email protected]';

Example 4: mysql update add to existing value

mysql> UPDATE tableName SET sometotal = sometotal+10 WHERE Id = 4;

Tags:

Sql Example