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 trialKenny Nadel
7,695 PointsI'm pretty sure my code is right. It's giving me an error. Any clues?
UPDATE phone_book SET first_name = "Mystery" AND last_name = "Person";
4 Answers
Jorge Hernandez
23,572 PointsTry: UPDATE phone_book SET first_name = "Mystery", last_name = "Person";
Change "AND" for ","
Laurie Gray
23,119 PointsThank you Jorge :) Sometimes you pour over things for ages, then realise it could all have been solved with a comma. :)
derek fentress
737 Pointsi did exactly that and still says its wrong update phone_book set first_name="Mystery", last_name="person" still showing as wrong
chase singhofen
3,811 Pointsidk why we cant use AND instead of comma
Victoria Duan
5,860 PointsI'd also like clarification why!
Laszlo Fazekas
815 PointsWondering, but maybe the answer is: the challange asks to modify ALL data in the phone_book. So, if you have John Doe and Jane Doe in your phone book, both will get the same name for different phone numbers. The name will be: Mystery Person. So, the solution: UPDATE phone_book SET first_name = "Mystery", last_name = "Person";
If you want to use AND you should use first WHERE condition. But for this you should first give for what to change it. In this case you have missing the information to put after SET command if you want to use WHERE and AND commands. For example: if the challange would ask to change John Doe's name to Al Pacino in every records, you could use WHERE command: UPDATE phone_book SET first_name = "Al", last_name = "Pacino" WHERE first_name = "John" AND last_name= "Doe"; This would not modify the name of Jane Doe.
Xayaseth Boudsady
21,951 PointsYou're missing the 's' in phone_books
UPDATE phone_books SET first_name = "Mystery" AND last_name = "Person";
Christian A. Castro
30,501 PointsXayaseth Boudsady You don't need to add 's to the table, phone_book is perfectly fine! just remove the 'AND'/replace it for ,
It should work:
UPDATE phone_book SET first_name = "Mystery", last_name = "Person";
Kenny Nadel
7,695 PointsKenny Nadel
7,695 PointsHere's the original question...
Now we're using a database from a smartphone. It has a phone_book table. It has the columns id, first_name, last_name and phone. Update all contacts to have the first name of "Mystery" and last name of "Person".