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
203,700 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
203,700 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".