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

Jonas Moltumyr
Jonas Moltumyr
1,939 Points

SQL basic, bug in code challenger? where clause

I dont get what's wrong with this query... Just a bug in the code challenger?

6 Answers

jason chan
jason chan
31,009 Points
SELECT * FROM users WHERE last_name = "Hinkley" or last_name = "Pettit";
Jonas Moltumyr
Jonas Moltumyr
1,939 Points

Of course...

Seems that I should go to sleep, my head not working properly now! Thanks anyway! :)

jason chan
jason chan
31,009 Points

Could you please post the question your having problems with?

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Jonas,

You'll need to post you code, and it's best to post from the quiz / challenge you are in.

Just click the "Get Help" link from the video / challenge / quiz you are in... make sure "include code" is checked.

This way the community will be able to help you.

:dizzy:

Jonas Moltumyr
Jonas Moltumyr
1,939 Points

I actually did that, wonder why it did not display. Anyway

Question: Challenge Task 2 of 2

Now we're in the e-commerce database. In the users table we have the columns id, username, password, first_name and last_name. Find all users with either the last name "Hinkley" or "Pettit"

SELECT * FROM users WHERE last_name = "Hinkley" OR "Pettit"
Jonas Moltumyr
Jonas Moltumyr
1,939 Points

SQL does not require you to have a semicolon at the end? It did not make a change either.

Here is the error I get from the code challenger: Bummer! Did you select from the users table and test the last_name column?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Could you post the link to the actual quiz / challenge?

jason chan
jason chan
31,009 Points

ending semicolon means the statement ends. It's a programming thing. The only languages that dont' have that are python or ruby.

Jonas Moltumyr
Jonas Moltumyr
1,939 Points

I do know my basic SQL, and have been writing queries for 4-5 years, and have never used semicolon at the end. So guess both works, have just been writing queries in SQL management Studio. Might be some function there that understands when the query is ending?

Jonas Moltumyr
Jonas Moltumyr
1,939 Points

Okey, Guess I haven't been working with databases that requires the semicolon then. Good thing, learned something new today as well :)

That is mainly why I'm taking this SQL Basic course. Might pick up a thing or two ;)