Database Reference
In-Depth Information
15.4
Changing Data (UPDATE)
The syntax for the UPDATE command is as shown in Figure 15.12.
You can update all rows in the table by omitting the WHERE clause.
List any or all column settings in the updated table after the SET keyword.
Any subquery must be a single-row subquery. A subquery can be a corre-
lated or regular subquery. Several UPDATE commands will be demon-
strated in the next sections.
Figure 15.12
UPDATE
Command Syntax.
Use the NULL keyword to set a column to a null value. Use the
DEFAULT keyword to set a column to its default value (as defined in the
table).
15.4.1
Updating One Row
You find out that Jewel now lives in Brazil, so you update the row contain-
ing Jewel's data. Note that we are using the TESTMUSICCD table created
in the previous section on the INSERT command.
UPDATE TESTMUSICCD SET ARTIST_COUNTRY='Brazil'
WHERE ARTIST_NAME = 'Jewel';
SQL*Plus Worksheet will reply, “1 row updated.” The same syntax can
be used to update more than one row.
Search WWH ::




Custom Search