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 trial

Databases Modifying Data with SQL Updating Data in a Database Updating Data With SQL

Trying to update with this query

UPDATE phone_book SET phone=8899832 WHERE first_name="Mystery" AND last_name="Person";

1 Answer

Steven Parker
Steven Parker
228,977 Points

The instructions say "Update all contacts to have the first name of "Mystery" and last name of "Person"."

But instead of updating the names, this code is looking for those names and then updating the phone number (where did you get that number?).

Fix the query so that it changes the names instead. You won't need a "WHERE" clause for this one.

But we have to update the contacts or the names.

Steven Parker
Steven Parker
228,977 Points

That's what I'm pointing out. The instructions tell you to update every contact, and change both the first and last name of each one. Since you will be changing all rows, you will not need a "WHERE" clause.

But they don't say anything about changing the phone number. Just set "first_name" and "last_name".