An UPDATE statement can update one or more column values for one or more rows in a table.
To selectively update, specify a WHERE clause in your UPDATE statement.
Let's first take a look at an UPDATE statement without a WHERE clause.
The following code shows A DML Statement for Updating the Authors Table. It changes the text case for authors table.
UPDATE authors
SET name = upper(name);
COMMIT;
The syntax used by Listing 1-18 is as follows:
UPDATE <table_name>
SET
<column_name_1> = <column_value_1>,
<column_name_2> = <column_value_2>,...
<column_name_N> = <column_value_N>;
<table_name> is the name of the table to update <column_name> is the name of a column to update, <column_value> is the value to which to update the column in question.
To update with an additional WHERE clause.
WHERE name <> upper(name)
That would have limited the UPDATE to only those rows that are not already in uppercase.
The following code is the DML for Updating Titles in the Publications Table
UPDATE author_books
SET title = upper(title)
WHERE title <> upper(title);
COMMIT;
UPDATE statements can be quite complex.
They can pull data values from other tables, for each column, or for multiple columns using subqueries.