Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
218,596 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
218,596 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".