Skip to main content

UPDATE Statement

This command is used to change the values in one or more columns of a table. The syntax of this command is:

UPDATE tablename

SET column = value [, column = value]

[WHERE condition];

The WHERE condition is optional but, if omitted, all the rows in the table are changed. Normally, this is not desired. It is a very common mistake, so take care when using this command.

For example:

To update the 'surname' and 'date of birth' of an employee whose employee number is 'EN1244':

UPDATE employee

SET surname = 'Wilson', date_of_birth = '07-Sep-1949'

WHERE employee_number = 'EN1244';

Next: DELETE Statement