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 question

We have an e-commerce database. Inside the users table we have the columns of id, username, password, first_name and last_name. Without using the OR keyword, find all the users with the username of "2spooky4me" or "beard_man".

i was thinking it would be

SELECT * FROM users WHERE username IN ("2spooky4me", "beard_man");

Keep getting "Did you test 'username' from users?"

Any thoughts?

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

That query is correct. Are you still having issues?

5 Answers

SELECT * FROM users WHERE username IN ("2spooky4me", "beard_man");

Jeff Lemay
Jeff Lemay
14,268 Points

Should you be selecting all or just the username?

SELECT username FROM users WHERE username IN ("2spooky4me", "beard_man")
Carl Conroy
Carl Conroy
8,677 Points

I just want to put this out there

"SELECT * FROM users WHERE username IN("2spooky4me", "beard_man");" is referenced as a correct answer. Hwoever when I enter this, I get an error saying I'm missing an "IN" keyword when I am not.

Additionally, if I enter the other query referenced above (SELECT username FROM users WHERE username IN ("2spooky4me", "beard_man")) I get an error saying I didn't return all columns.

Calvin Secrest
Calvin Secrest
24,815 Points

@Carol If you haven't already found the mistake, I've notice you added an extra quotation mark after the semi colon, that is where you error is coming from.

This is what you have shown: SELECT * FROM users WHERE username IN ("2spooky4me", "beard_man");"

This is the correct code: SELECT * FROM users WHERE username IN ("2spooky4me", "beard_man");

@Jeff Thanks for the help, it was select all.

Andrew Chalkley yeah everything is correct!

thanks for checking in