Skip to content

Instantly share code, notes, and snippets.

@sanaulla123 sanaulla123/world.sql
Last active Jun 14, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.