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 trialLaura Sievert
349 PointsCan you check this line? I think it's right and the challenge isn't letting me move on!
SQL question-- I think my answer is right!
The question says Find all users with either the last name Hinkley or Pettit and my code is
SELECT * FROM users WHERE last_name = "Hinkley" OR "Pettit";
and the hint that pops up says "Bummer! Did you select from the 'users' the last name? ... I think I did do that!
1 Answer
Jeff Lemay
14,268 PointsTo check multiple values for a single column, you can go one of two routes:
SELECT * FROM users WHERE last_name="Hinkley" OR last_name="Pettit";
SELECT * FROM users WHERE last_name IN ("Hinkley", "Pettit");
Laura Sievert
349 PointsRight. That's what I wrote in this one (your first example)... I think the question is flawed. It keeps asking if I queried the right table and the right column, and those two are correct. Is there a way to report a bad question? I know they just added this SQL course recently- maybe it's a bug!
Jeff Lemay
14,268 PointsYou need to say last_name= twice. "Pettit" is not being checked against anything.
Laura Sievert
349 PointsAh crap. Never mind. I didn't realize you had to write last_name in there twice. Thanks Jeff!
Jeff Lemay
14,268 PointsNo problem. Enjoy the journey!
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsMOD NOTE: Changed topic of question from "General Discussion" to "Databases."