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 trialSandeep Singh
6,083 Pointsstuck in SQL (Union) task
my following code is not working
select * from Fruit where Name >= 'A' AND Name <= 'K' union select * from Vegetable where Name >= 'A' AND Name <= 'K';
2 Answers
Steven Parker
231,198 PointsWhen you use "Name <= 'K'
" as a filter, you're accepting names that come before "K" in the alphabet, and the letter "K" itself. If you want the results to include all words that begin with "K", use "Name < 'L'
" as the filter instead.
Also, you're not likely to encounter words that come before "A" in the alphabet, so you probably don't need the other filter at all.
Sandeep Singh
6,083 PointsI worked Thanks!
Sandeep Singh
6,083 PointsSandeep Singh
6,083 Pointsselect * from Fruit where Name < 'L' union select * from vegetable where Name < 'L';
Still not working .. I want to query all the names from 'A' through 'K' Can you show me the exact code?
Steven Parker
231,198 PointsSteven Parker
231,198 PointsIn that case, select name instead of
*
.If that doesn't solve it (and for future questions) please provide a link to the course page.