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 trialOdane Williams
6,692 PointsI followed all the examples but I'm getting an error that says the query is not returning through A and K.
Is it my syntax?
SELECT Name FROM Fruit WHERE Name BETWEEN "A" AND "K" UNION SELECT Name FROM Vegetable WHERE Name BETWEEN "A" AND "K" ORDER BY Name;
1 Answer
Steven Parker
231,268 PointsYou're close, but BETWEEN "A" AND "K"
would not include any names that begin with "K" unless the name was just the single letter "K" itself.
You might want to make use of an inequality comparison, since they work on dictionary order when used with strings.
Also, I don't think the task asks you to ORDER
the results in any particular way.
Odane Williams
6,692 PointsThank you. I solved it by using WHERE Name < "L". Could I have used LIKE "A%" AND "K%" also?
Steven Parker
231,268 PointsThat expression isn't complete, but even if you used WHERE Name LIKE "A%" OR Name LIKE "K%"
that would only give you names starting with "A" and "K" and nothing in between. Combining with AND
would produce no output, because no name could start with both letters.
Steven Parker
231,268 PointsSteven Parker
231,268 PointsShow your complete query so we can see.