Databases Querying Relational Databases Set Operations Set Operations

Mark Mazur Lussenburg
Mark Mazur Lussenburg
9,027 Points

Challenge task 2 relational databases SET OPERATIONS

The task is about finding 'name' from the respective 'vegetable' and 'fruit' table, but only finding the items that starts with the letter A through K.

my code looks like this;

SELECT name FROM fruit UNION SELECT name FROM vegetable WHERE name < "L";

i have no idea why this don't work, as it works with other tables in the SQL playground.

//E

Troy Erby
Troy Erby
6,332 Points

I actually wrote the same line of code when I attempted the challenge and got the following error:

"Your UNION queries didn't bring back a union of fruits and veggies beginning with the letters A through K!"

I also have no idea why this doesn't work

2 Answers

Shaun Sweeney
Shaun Sweeney
6,216 Points

SELECT name FROM fruit WHERE name < "L" UNION SELECT name FROM vegetable WHERE name < "L";

Mark Mazur Lussenburg
Mark Mazur Lussenburg
9,027 Points

oh i see, there should be a where clause on both parts of the select, thanks! :D