You use the SQL UPDATE statement to modify existing rows in a table. Just as with performing an INSERT statement with JDBC, you can use the executeUpdate() method defined in the Statement class or the execute() method defined in the PreparedStatement class. Use of the PreparedStatement class is covered later in this chapter.
The following example illustrates how to modify the row where the customer_id column is equal to 1:
first_name = "Jean"; myStatement.executeUpdate("UPDATE customers " + "SET first_name = '" + firstName + "' " + "WHERE customer_id = 1");
Once this statement has completed, customer #1 s first name will be set to Jean .