The UPDATE command modify one or more existing rows of a table.SQL Syntax:
UPDATE table_name
SET column_name = <new value>[,...n]
[FROM <source>]
[WHERE <condition>]
Arguments:
table_name |
|
The name of the table which rows should be modified.
|
column_name |
|
The name of a column that should receive a new value.
|
<new value> |
|
Any expression that can be evaluate to a new value. This can be a
constant expression, a
SQL function
or combination of both. If you use a PreparedStatement of the JDBC
interface then you can also use a question mark for a dynamic parameter.
|
FROM <source> |
|
An optional parameter to descript a source for the <new values>.
This can be a table or a join. This is helpful if the <new values> come
from another table. |
WHERE <condition> |
|
A filter to select the rows that should be updated. If not set then
all rows will be updated. It can also used for filtering the FROM <source>. |
Examples:
UPDATE myTable SET surname = 'John', lastname = 'Smith' WHERE
userid = 234
see also:
SQL Syntax
|