SQL Update Statement


Update records in a table.

Syntax

UPDATE table_name set column = value_expression [, column = value_expression...] WHERE expression
table_name:  name of the table to delete the records from
expression:   column | constant | parameter | not expression | (expression) |
expression operator expression | in (expression [, expression...])
operator:   or | and | = | != | < | > | <= | >=
value_expression:  value to set. May be parameter or constant
parameter:  the literal "?"
constant:  String, double, long, etc..

Example


PreparedStatement stmt = conn.prepareStatement("update persons set name='john' where name=?");
stmt.setString(1, "bob");
stmt.executeUpdate();