Databases Querying Relational Databases Set Operations Union All Operations

Claire Brehm
Claire Brehm
9,098 Points

Having trouble with question 3

My code is

SELECT name FROM fruit UNION ALL SELECT name FROM vegetable ORDER BY name DESC;

prompt is 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!

Thanks in advance!

2 Answers

The instructions include "Ensure that it is in alphabetical order" so you wouldn't use DESC.

Ariadna Rodriguez
Ariadna Rodriguez
5,995 Points

SELECT Name FROM Fruit UNION ALL SELECT Name FROM Vegetable ORDER BY Name ASC;