H2 Database Update - H2 Database

What isH2 Database Update?

The update query is used to update or modify the existing data in a table. we can use where clause with update query to update the selected rows, otherwise, all the rows could be affected.

Syntax

Following is the basic syntax of the UPDATE query.

In this UPDATE syntax, we can combine more than one condition by using AND or OR clauses.

Example

Consider the CUSTOMER table having the following records.

If you want to get the customer table along with the given data, execute the following queries.

The following command is an example, which would update ADDRESS for a customer whose ID is 6 −


Now, CUSTOMERS table would have the following records. We can check the customer table records by executing the following query.


The above query produces the following result.

To modify all ADDRESS and SALARY column values in CUSTOMERS table, we need not use the WHERE clause. The UPDATE query would be as follows −

Now, CUSTOMERS table would have the following records. We can check the customer table records by executing the following query.

The above query produces the following result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

H2 Database Topics