Updating Values

The UPDATE statement is used to change the values in an existing record.

The UPDATE statement has this general format:

Format of SQL UPDATE statement

Additional information

UPDATE tablename    SET      colName1=value1  ,colName2=value2 ...     <— can provide a value for all    WHERE                                       attributes or just some      colNamei  someOperator  valuei   ...      <— can repeat this line, ;                                              separated by AND or OR

Here is an example of the use of the UPDATE statement:

Example of SQL UPDATE statement

Additional information

UPDATE Person   SET  age = 25, lives_in = 'USA'   Robert celebrated his birthday by moving to   WHERE name='Robert Bellamy' ; ...

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.