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 Querying Relational Databases Set Operations Set Operations

Mark Mazur Lussenburg
Mark Mazur Lussenburg
25,338 Points

Challenge task 2 relational databases SET OPERATIONS

The task is about finding 'name' from the respective 'vegetable' and 'fruit' table, but only finding the items that starts with the letter A through K.

my code looks like this;

SELECT name FROM fruit UNION SELECT name FROM vegetable WHERE name < "L";

i have no idea why this don't work, as it works with other tables in the SQL playground.

//E

Troy Erby
Troy Erby
6,332 Points

I actually wrote the same line of code when I attempted the challenge and got the following error:

"Your UNION queries didn't bring back a union of fruits and veggies beginning with the letters A through K!"

I also have no idea why this doesn't work

2 Answers

Shaun Sweeney
Shaun Sweeney
6,216 Points

SELECT name FROM fruit WHERE name < "L" UNION SELECT name FROM vegetable WHERE name < "L";

Mark Mazur Lussenburg
Mark Mazur Lussenburg
25,338 Points

oh i see, there should be a where clause on both parts of the select, thanks! :D