Difference between revisions of "UPDATE"
Jump to navigation
Jump to search
Line 26: | Line 26: | ||
# Use the [[sample database]] and insert and populate it with the data from the [[File::/etc/shadow]]. |
# Use the [[sample database]] and insert and populate it with the data from the [[File::/etc/shadow]]. |
||
== Additional |
== Additional Information == |
||
* [http://www.w3schools.com/SQL/sql_update.asp W3Schools on SQL UPDATE] |
* [http://www.w3schools.com/SQL/sql_update.asp W3Schools on SQL UPDATE] |
||
* [http://dev.mysql.com/doc/refman/5.0/en/update.html MySQL 5.0 UPDATED documenation] |
* [http://dev.mysql.com/doc/refman/5.0/en/update.html MySQL 5.0 UPDATED documenation] |
||
* [http://www.postgresql.org/docs/9.0/static/sql-update.html PostgreSQL 9.0 UPDATE documentation] |
* [http://www.postgresql.org/docs/9.0/static/sql-update.html PostgreSQL 9.0 UPDATE documentation] |
||
* [http://www.sqlite.org/ |
* [http://www.sqlite.org/lag_update.html SQLite3 UPDATE documentation] |
Revision as of 02:41, 19 January 2011
{{#set:Related SQL command=INSERT|Related SQL command=DELETE|Related SQL command=SELECT}}
UPDATE is refers to the SQL command UPDATE.
Summary
The UPDATE command is used to update existing records in a table. Syntax may vary between certain types of databases but is generally uniform across multiple vendors.
Syntax
UPDATE <table> SET <column> = <value> [, <column> = <value>] [, ...]] [ WHERE <condition> ]
Examples
To update the value from "foo" to "foobar" in column "bar" in table "baz" do the following:
INSERT INTO baz ( bar ) VALUES( "foo" ) UPDATE baz SET bar = "foobar" WHERE bar = "foo"
Note: This will udpdate all the instances where bar has a value of "foo" to "foobar"
Excersises
- Use the sample database and insert and populate it with the data from the [[File::/etc/shadow]].