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 in a Database Review

Daniel Rego
Daniel Rego
7,949 Points

Confused on this quiz question? 'UPDATE games SET platform = 'Cross-Platform' WHERE id [ ] (1,4)

Confused because --- when adding a WHERE clause, don't you need to make that WHERE clause = to a column name? In this case, wouldn't it be "= (1,4)"?

3 Answers

Hi Daniel,

It would be = if you were checking a specific column number as in WHERE id = 1 but here we're checking against a set of values. There's another keyword that you're supposed to use here.

As a hint, they're asking for what would be the shorter way to do this: WHERE id = 1 OR id = 4

I realized you might be having trouble with this because it's part of the prerequisite knowledge for this course.

Here's the video from "SQL Basics" that should help you with what you need for this question.

https://teamtreehouse.com/library/sql-basics/finding-the-data-you-want/searching-within-a-set-of-values

I would recommend you take that entire course if you haven't already. There's also a cheat sheet you can download in the teacher's notes which might help you get through this course easier.

Daniel Rego
Daniel Rego
7,949 Points

Thanks Jason,

I realized the BETWEEN when I noticed before I even saw the second post. Much appreciated.

You're welcome.

Are you sure that it passed with BETWEEN?

That wouldn't be correct. In my answer, I was trying to lead you to using IN

I'm rusty on using IN because so far I've used AND & OR more...when would we want to use IN vs. OR?

I'd say use IN whenever you can because it's less typing and less chance of making an error.

In this example you have WHERE id = 1 OR id = 4 vs. WHERE id IN (1, 4)

The IN version is more concise and you only have to type the column name one time.