Skip to content

Instantly share code, notes, and snippets.

@sanaulla123
Last active March 8, 2023 10:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sanaulla123/98a56e65213925fd2572d36144949310 to your computer and use it in GitHub Desktop.
Save sanaulla123/98a56e65213925fd2572d36144949310 to your computer and use it in GitHub Desktop.
select
co.Code '_id',
co.Code 'code',
co.name 'name',
co.Continent 'continent',
co.region 'region',
co.SurfaceArea 'surface_area',
co.IndepYear 'year_of_independence',
co.Population 'population',
co.LifeExpectancy 'life_expectancy',
co.GovernmentForm 'government_form',
co.Code2 'iso_code',
capital.ID 'capital.id',
capital.Name 'capital.name',
capital.District 'capital.district',
capital.Population 'capital.population',
ci.Name 'cities[name]',
ci.id 'cities[id]',
ci.District 'cities[district]',
ci.Population 'cities[population]',
cl.Language 'languages[language]',
cl.IsOfficial 'languages[official]',
cl.Percentage 'languages[percentage]'
from country co
left outer join city capital ON capital.ID = co.Capital
left outer join city ci ON ci.CountryCode = co.Code
left outer join countrylanguage cl on cl.CountryCode = co.Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment