-
-
Save codecademydev/16a5fe540cdabca2ab77bf7223b17dad to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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