O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating Rows with UPDATE

The UPDATE statement changes the values in a table’s existing rows. You can use UPDATE to update:

  • All rows in a table

  • Specific rows in a table

To update rows, you specify:

  • The table to update

  • The names of the columns to update and their new values

  • An optional search condition that specifies which rows to update

The important characteristics of UPDATE are:

  • UPDATE takes an optional WHERE clause that specifies which rows to update. Without a WHERE clause, UPDATE changes all the rows in the table.

  • UPDATE is dangerous because it’s easy to omit the WHERE clause mistakenly (and update all rows) or misspecify the WHERE search condition (and update the wrong rows). It’s wise to run a SELECT statement that uses the same WHERE clause ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required