Update statement

The UPDATE statement lets you edit an existing row in a table.


					UPDATE table_name
SET column_name = "new value"
WHERE row_name = "existing value"

For Example:

Your employer has asked you to remove $5000 from the balance of the person whose ID=1003.

The SQL statement would be:

					UPDATE customer
SET Balance = Balance - 5000
WHERE id = 1003;


Let’s break down our statement:
  • UPDATE is followed by the name of the table
  • SET is followed by the column name
  • On our example, we have to remove $5000 from existing value. That’s why, we have to SET the Balance to be equal to Balance subtracted by $5000.
  • On the last line, WHERE clause is used to specify the name of the row from which we want to reduce the value.
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments