DatabaseLesson 10Free preview
PostgreSQL UPDATE
This lesson is part of PostgreSQL · All levels
Summary
The UPDATE command changes the value of the column on a row that meets certain conditions. The most important thing to note is the WHERE clause, because without WHERE all the rows on the table will change. Always use the BEGIN and ROLLBACK transactions when testing important updates to make changes easily reversed.
Key points
- UPDATE... set... change the value of the column on the line that matches the condition.
- Without WHERE, the entire row on the table goes up.
- Can update multiple columns at once with a comma in the SET.
- Wrap it up in a transaction so you can roll back if the results go wrong.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.