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

WHY I GOT AN ERROR EVERYTIME TYPE SELECT * FROM users WHERE last_name = "Hinkley"OR "Pettit";

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";

2 Answers

Steven Parker
Steven Parker
231,261 Points

You're very close! But you can't combine elements on one side of a test like that. Try it this way:

SELECT * FROM users WHERE last_name = "Hinkley" OR last_name = "Pettit";

Or this way (I may be getting ahead of your point in the course here):

SELECT * FROM users WHERE last_name IN ("Hinkley", "Pettit");

THANK YOU VERY MUCH I'VE BEEN STUCK IN THIS PART FOR 30 MIN OR SO

Victor Rivera
Victor Rivera
827 Points

Steven, that is a great approach, I have been stock on this for over 45 minutes I was making the same mistake. You rule!