Bummer! You have been redirected as the page you requested could not be found.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Sometimes you need to use SQL to update values in all rows or columns of a table, whether to fix an error, update a status, or something else. This video will show you how to update data in SQL.
SQL Used
An update statement for all rows:
UPDATE <table> SET <column> = <value>;
The =
sign is different from an equality operator from a WHERE
condition. It's an assignment operator because you're assigning a new value to something.
Examples:
UPDATE users SET password = "thisisabadidea";
UPDATE products SET price = 2.99;
Update multiple columns in all rows:
UDPATE <table> SET <column 1> = <value 1>, <column 2> = <value 2>;
Examples:
UPDATE users SET first_name = "Anony", last_name = "Moose";
UPDATE products SET stock_count = 0, price = 0;
See all of the SQL used in Modifying Data With SQL in the Modifying Data With SQL Cheatsheet.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up