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

I am looking for a way to create a list of all fruits and vegetable from A - K; I have used BETWEEN and the > L, help.

SELECT * FROM Fruit WHERE Name < "L"
     UNION
SELECT * FROM Vegetable WHERE Name < "L";

OR

SELECT * FROM Fruit WHERE Name BETWEEN "A" AND "L"
     UNION
SELECT * FROM Vegetable WHERE Name BETWEEN "A" AND "L"; 
Bramyn Payne
Bramyn Payne
19,589 Points

I believe the challenge is asking to select a list of the names of fruits and veggies, not everything from the table. Hope that helps!

1 Answer

I believe the correct answer is:

SELECT DISTINCT(Name) FROM Fruit WHERE Name < "L" UNION SELECT DISTINCT(Name) FROM Vegetable WHERE Name < "L";