UPDATE Statement Syntax
Update Statement is used to modify existing rows in table.
Below is Update State Syntax :
UPDATE table
SET column = value [, column = value, ...]
[WHERE condition];
In the syntax:
table is the name of the table
column is the name of the column in the table to populate
value is the corresponding value or subquery for the column
condition identifies the rows to be updated and is composed of column names expressions, constants, subqueries, and comparison operators
Updating Rows in a Table
•Specific row or rows are modified if you specify the WHERE clause.
•All rows in the table are modified if you omit the WHERE clause.
Updating Rows Based on Another Table
You can use subqueries in UPDATE statements to update rows in a table. The example on the slide updates the COPY_EMP table based on the values from the EMPLOYEES table. It changes the department number of all employees with employee 200’s job ID to employee 100’s current department number.
No comments:
Post a Comment