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

Daniel Cronin
Daniel Cronin
4,466 Points

As far as I can tell I am correctly updating the rows in the table but the Challenge Task keeps failing.

I have tried update phone_book set (first_name, last_name) = ('Mystery', 'Person');

AND

update phone_book set first_name = 'Mystery'; update phone_book set last_name = 'Person';

1 Answer

Steven Parker
Steven Parker
218,691 Points

You're close, and your second try would actually work in practice. But the challenge wants you to to construct a single query that sets both values.

To set multiple values at a time, you can just separate them by commas. Here's a generic example:

UPDATE table SET field1 = value1, field2 = value2;
Daniel Cronin
Daniel Cronin
4,466 Points

Thank you for the help. I could have sworn I tried that syntax originally but I guess not. Grouping with parentheses works in my IDE. Is it not correct syntax for SQLite?

Steven Parker
Steven Parker
218,691 Points

That would also work in practice, I'm not sure why it doesn't pass the challenge. But it's probably not the technique that was shown in the videos.

I'd normally suggest submitting a bug report, but considering the recent changes, I suspect there's nobody to handle it.