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 update the content of lastname for every entry in the customers table. The old and new contents of the database table are illustrated below on the left and right respectively:

Notice: It is necessary to use conditional clauses (WHERE) in UPDATE query. If you do not use any conditional clause then all records of that table’s attribute will be updated. In above example new value (Smith) of lastname in customers table set to all rows.

Feedback about page:

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



Table Of Contents