I’m trying to find the country with the smallest population in the region ‘Southern Europe’ from the following Postgres db schema
CREATE TABLE country (
code character(3) NOT NULL,
name text NOT NULL,
continent text NOT NULL,
region text NOT NULL,
surfacearea real NOT NULL,
indepyear smallint,
population integer NOT NULL,
lifeexpectancy real,
gnp numeric(10,2),
gnpold numeric(10,2),
localname text NOT NULL,
governmentform text NOT NULL,
headofstate text,
capital integer,
code2 character(2) NOT NULL,
CONSTRAINT country_continent_check CHECK ((((((((continent = 'Asia'::text) OR (continent = 'Europe'::text)) OR (continent = 'North America'::text)) OR (continent = 'Africa'::text)) OR (continent = 'Oceania'::text)) OR (continent = 'Antarctica'::text)) OR (continent = 'South America'::text)))
);
I’ve had no problem listing the countries out in population order using this query
SELECT name, continent, region, population FROM country WHERE region = 'Southern Europe' ORDER BY population ASC;
and know that I need to use MIN(population)
in there somewhere to get the singular result I want (it’s the Vatican fwiw), but no amount of reconfiguring the query has got me anything other than an error. Can someone point me in the right direction?
There are 15 results for ‘Southern Europe’ out of approx 240 countries total.