Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Querying Relational Databases Set Operations Set Operations

Geovani Mejia
seal-mask
.a{fill-rule:evenodd;}techdegree
Geovani Mejia
Front End Web Development Techdegree Student 7,940 Points

Help with Querying Relational Databases

HERE IS THE CHALLENGE QUESTIONS:

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.

HERE IS MY ANSWER:

SELECT Name FROM Fruit WHERE Name >= "A" AND Name <= "K" UNION SELECT Name FROM Vegetable WHERE Name >= "A" AND Name <= "K" ORDER BY name;

2 Answers

Steven Parker
Steven Parker
218,596 Points

Your range isn't quite inclusive enough. For example, Name <= "K" would cover the letter "K" itself but not a word like "Kale".

Try Name < "L", it would cover all words that begin with K.