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 trial

Databases

SQL playground, stage 3 -- Who are the actors with the ids of 12127, 6901, 2071 and 2831?

Heya, I can't work it out :@( maybe because its last thing on a friday..?

-- Who are the actors with the ids of 12127, 6901, 2071 and 2831?

SELECT * FROM actors WHERE id = 12127;

Juan Trujillo
Juan Trujillo
9,391 Points

Try:

SELECT * FROM actors WHERE id IN (12127, 6901, 2071, 2831)

1 Answer

Steven Parker
Steven Parker
231,261 Points

Remember, when you want to test for more than one value, you use IN.


:warning: SPOILER ALERT


SELECT * FROM actors WHERE id IN (12127, 6901, 2071, 2831);

You could also do it with equality tests combined with OR, but it's more verbose:

SELECT * FROM actors WHERE id = 12127 OR id = 6901 OR id = 2071 OR id = 2831;

Thanks, Steven! I was using "IS instead of "IN" in front of the parentheses and I kept getting a "Error: row value misused".