. Advertisement .
..3..
. Advertisement .
..4..
Hi guys, Today I get the error ”list each continent and the name of the country that comes first alphabetically.” when running my code.
Select x.continent, x.name
From world x
Where x.name <= ALL (select y.name from world y where x.name=y.name)
ORDER BY name
I don’t know what the reason is. Can someone help me?
The cause: This error happens because if both instances of the same nation have the same name, using
x.name=y.name
compares the names of the two countries. That would essentially just give you the entire table x.Because you only want to compare the nation names of an instance from x and an instance from y if they share the same continent, you should use the formula
x.continent=y.continent
.Solution: It should be: