Scenario world
f35f7fece0cf0019765619c477c900ddd8131dbc27b32e9261f4ab7cdc49773c
See details on the model
In this scenario, we have a single table world in which each row describes a country. The table contains the following attributes:
- name of type VARCHAR(50) NOT NULL, the name of the country (e.g. France)
- continent of type VARCHAR(60), in which continent is the country in (e.g. Europe)
- area of time DECIMAL(10) the area of the country in square kilometer
- population of type DECIMAL(11) the number of inhabitants
- gdp of type DECIMAL(14) the Gross Domestic Product
- capital of type VARCHAR(60) the name of the capital city
- tld of type VARCHAR(5) the Top Level Domain of the country (the last part of the domain names of the country, e.g. .fr for France)
- flag of type VARCHAR(255) an url of the flag of the country
Question
Return a table with a column alpha containing the first letter of country names (ordered alphabetically) and a column total with the total population of countries whose name starts with that letter.
*Hint: use SUBSTR (see documentation https://www.postgresql.org/docs/current/functions-string.html). *
{"rows":[["A","173582410"],["B","443200219"],["C","1626386423"],["D","16037011"],["E","206321910"],["F","72222076"],["G","156231174"],["H","28847283"],["I","1685777360"],["J","136410181"],["K","71738881"],["L","29817563"],["M","336696707"],["N","281891681"],["O","4020000"],["P","384881732"],["Q","2174035"],["R","176479864"],["S","342108327"],["T","243441355"],["U","504017072"],["V","118920492"],["Y","25235000"],["Z","28084554"]],"fields":[{"name":"alpha","dataTypeID":25},{"name":"sum","dataTypeID":1700}],"affectedRows":0}
True
False