The Update Statement
The UPDATE statement is used to modify the data in a table.
Syntax
UPDATE table_name |
Person:
LastName | FirstName | Address | City |
---|---|---|---|
Nilsen | Fred | Kirkegt 56 | Stavanger |
Rasmussen | Storgt 67 |
Update one Column in a Row
We want to add a first name to the person with a last name of "Rasmussen":
UPDATE Person SET FirstName = 'Nina' |
Result:
LastName | FirstName | Address | City |
---|---|---|---|
Nilsen | Fred | Kirkegt 56 | Stavanger |
Rasmussen | Nina | Storgt 67 |
Update several Columns in a Row
We want to change the address and add the name of the city:
UPDATE Person |
Result:
LastName | FirstName | Address | City |
---|---|---|---|
Nilsen | Fred | Kirkegt 56 | Stavanger |
Rasmussen | Nina | Stien 12 | Stavanger |
No comments:
Post a Comment