I’ve got a table bbc with the following columns:
name (refers to a name of a country within a particular region of the world)
region (continent of the world)
population (population of the country in the name name field)
The question I’m trying to answer:
The question is as follows:
“Some countries have populations more than three times that of any of their neighbours (in the same region). Give the countries and regions.”
I was thinking the answer might be something like:
SELECT a.name, a.region FROM bbc AS a
WHERE a.region IN
(
SELECT b.region FROM bbc AS b
GROUP By b.region
HAVING MIN(b.population) < 3*b.population)
But honestly, I lose it at that last line… I have no idea how I would find counteries that have more than three times that of any of their neighbours in the same region! Quite tough. O_o
Any and all help would be appreciated.
1 Answer