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

Create a list of all fruits and vegetables starting with the letters A through K

https://teamtreehouse.com/library/querying-relational-databases/set-operations/set-operations

I wrote the query as follows :

Select DISTINCT *from fruit union select DISTINCT *from vegetable where Name Like '%A_k%'

5 Answers

Agnes Demes
Agnes Demes
6,613 Points

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

Did you got the answer is right?

Mine is still there is error.> select Name from Fruit where Name Like '%A_k%' Union select Name from Vegetable where Name Like '%A_k%'

Blackberry Blackcurrant Daikon Radish Jackfruit

Agnes Demes
Agnes Demes
6,613 Points

Hi Mehiret, in your example the Like keyword is specifying values %A starting with A and having the letter K in them..may be this would return ArtichoKe.. you could use a solution WHERE Name < "L" meaning where the name starts with A - K as these letters are all smaller then L. hope this helps

Hi Agnes,

i am still getting the error : Your UNION queries didn't bring back a union of fruits and veggies!

Please Help Me!!

Thank you So much !! I did It!!

Agnes Demes
Agnes Demes
6,613 Points

These quizes are asking for very specific results, you could add an extra column and get an error. bring back the Name columns only in both tables.

Agnes Demes
Agnes Demes
6,613 Points

oh good, happy coding :)