After you add a table and create a SET clause in an UPDATE
statement in the SQL Query Builder, you can create a WHERE clause.
The WHERE clause specifies which rows in the database table to update.
Before you begin
When you create a WHERE clause, you are specifying conditions
that determine which rows to update. Any row in the table that matches
the conditions that you specify is updated. If the UPDATE statement
does not have a WHERE clause, all rows of the target table are updated.
Before
you create WHERE clauses using the the SQL Query Builder, ensure you
have the following configuration:
- The UPDATE statement must be open in the SQL Query Builder.
- The UPDATE statement must contain a table specification.
Procedure
To create a WHERE clause:
- In the Design pane of the SQL Query Builder, click the Where tab.
- Double-click the cell under the Column heading.
Either click the column to include in the condition or click Build
Expression and build the expression to include in your
condition.
- Double-click the adjoining cell under the Operator heading,
and then select an operator from the list.
- Double-click the adjoining cell under the Value heading,
and then type a value. You can also select a column from
the list or click Build Expression to use the
Expression Builder wizard to create a value. The value can be a host
variable that can be substituted with a value at run time. Click outside
of the row when you are finished.
- Add further conditions if needed. Before adding another
condition, double-click the adjoining cell under the AND/OR heading
and specify how to evaluate the conditions. For example, if two conditions
must both be true to update a row, click AND in
the list for the first condition.