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

Can not figure out the answer to this question. Only show values between A-L.

There are two tables Fruit and Vegetable table. The Fruit table has a FruitID and a Name column and the Vegetable table has a VegetableID and Name column. Create a list of all fruits and vegetables starting with the letters A through K . In other words all fruit and vegetables that don't start with the letter L to Z.

My answer was ... SELECT * FROM fruit WHERE name <= "L" UNION SELECT * FROM vegetable WHERE name <= "L" ORDER BY name

I have tried using just <"L" . I've tried using different letters. I work with programers and I asked them for help and they couldn't figure out the answer either. Am I suppose to use EXCEPT? I'm not sure. Can someone help please?

SELECT * FROM fruit WHERE name <= "K" UNION SELECT * FROM vegetable WHERE name <= "K" ORDER BY name

DOES NOT WORK ^ ^ ^

1 Answer

NEVERMIND ----- GOT IT. Heres the answer.

SELECT name FROM fruit WHERE name < "L" UNION SELECT name FROM vegetable WHERE name < "L" ORDER BY name

They only wanted the name column. Not SELECT * .