Basic Update

suggest change

Updating one row

UPDATE customers SET email='luke_smith@email.com' WHERE id=1

This query updates the content of email in the customers table to the string luke_smith@email.com where the value of id is equal to 1. The old and new contents of the database table are illustrated below on the left and right respectively:


Updating all rows

UPDATE customers SET lastname='smith'

This query updates lastname for every row in the customers table. The old and new contents of the table are illustrated below, on the left and right respectively:

Notice: Use a WHERE clause unless you intend to change every row. Without one, every row’s lastname is set to smith.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents