Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJoey Domhof
3,163 PointsHow can you update 2 columns in the same table at the same time while using only 1 statement?
Hi team,
In the course "Modifying Data with SQL", the first quiz (q2/2), I have to update 2 columns in the phone_book table with only 1 statement. When entering the command below:
UPDATE phone-book SET first_name = "Mystery" AND last_name = "Person"
I would expect both columns to be updated with the given values. However my statement returns with no updates whatsoever. Could you please support and explain what is wrong in my statement and how to write it correctly?
Thank you so much. Joey
1 Answer
Steven Parker
231,261 PointsSeparate multiple SET assignments with commas:
UPDATE phone-book SET first_name = "Mystery", last_name = "Person"
(AND is for combining tests.)
Joey Domhof
3,163 PointsJoey Domhof
3,163 PointsHi Steven,
Indeed, this statement was accepted. Thank you so much for the quick and accurate response!
Joey