You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 21, 2019. It is now read-only.
SELECT name, continent FROM countries first
WHERE population > 3 * (SELECT avg(population)
FROM countries second where first.continent = second.continent
GROUP BY continent);
should satisfy this answer.
The output is as follows:
name | continent
------------------------------+---------------
Brazil | South America
China | Asia-Pacific
Cuba | Americas
Democratic Republic of Congo | Africa
Egypt | Middle East
Ethiopia | Africa
France | Europe
Germany | Europe
Guatemala | Americas
India | South Asia
Indonesia | Asia-Pacific
Iran | Middle East
Italy | Europe
Nigeria | Africa
Russia | Europe
South Africa | Africa
Turkey | Europe
United Kingdom | Europe
(18 rows)
For instance, select population from countries where name = 'Turkey'; (73300000)
is higher than the average of other European countries: select 3 * avg(population) from countries where continent = 'Europe'; (17404680.851063829787)