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

SET Problem

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 fruits and vegetables that includes any potential duplicate values. Ensure that it is in alphabetical order so that the duplicates are next to each other!

My Code: SELECT * FROM FRUIT UNION ALL SELECT * FROM Vegetable WHERE Name;

2 Answers

Oscar Lanzendorf
Oscar Lanzendorf
9,747 Points

Thats the correct line:

'''sql SELECT name FROM FRUIT UNION ALL SELECT name FROM Vegetable ORDER BY Name ASC; '''

Steven Parker
Steven Parker
231,140 Points

Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime. :fishing_pole_and_fish:
    ― Maimonides

Steven Parker
Steven Parker
231,140 Points

Your WHERE clause is incomplete.

It would need some kind of comparison expression, not just a column name. However:

  • from the instructions, it doesn't seem like you will need a WHERE clause at all
  • but you will need an ORDER BY clause to sort the output by name
  • only the names need to be selected

I'll bet you can get it now without an explicit spoiler.

Remember, to enable the most accurate and complete answers, always show your code and also provide a link to the course page you are working with.