Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created March 16, 2020 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/16a5fe540cdabca2ab77bf7223b17dad to your computer and use it in GitHub Desktop.
Save codecademydev/16a5fe540cdabca2ab77bf7223b17dad to your computer and use it in GitHub Desktop.
Codecademy export
SELECT count(*) FROM countries
WHERE continent = 'Africa';
SELECT id, count(*) FROM countries
WHERE continent = 'Oceania';
SELECT * FROM population_years
limit 10;
SELECT * from population_years
where year = '2005' and country_id = 213;
SELECT id, count(*) FROM countries
Where continent = 'South America';
SELECT * from population_years
where year = '2003' and country_id = 48;
SELECT country_id, MIN(population) FROM population_years
where year = 2007;
SELECT * FROM countries
where continent = 'Europe' and name = 'Poland';
SELECT AVG(population) FROM population_years
where country_id = 76;
SELECT * FROM countries
where name like '%the%';
SELECT * FROM population_years
where year = 2010
group by country_id;
SELECT count(id),continent FROM countries
group by continent;
SELECT continent, sum(population)
FROM countries
LEFT JOIN population_years population
ON countries.id=population.country_id
WHERE year=2010
GROUP BY continent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment