전체 글

nembizzang의 공부 블로그입니다. 개발 블로그는 https://velog.io/@nembizzang
SQL 문제풀이

[해커랭크 SQL] Aggregation - Population Density Difference

❓ Question https://www.hackerrank.com/challenges/population-density-difference Population Density Difference | HackerRank Query the difference between the maximum and minimum city populations in CITY. www.hackerrank.com ❗ Answer SELECT MAX(population) - MIN(population) FROM city; 📌 Discussion max - min으로 최댓값 - 최솟값 추출

SQL 문제풀이

[해커랭크 SQL] Aggregation - Japan Population

❓ Question https://www.hackerrank.com/challenges/japan-population Japan Population | HackerRank Query to the sum of the populations of all Japanese cities in CITY. www.hackerrank.com ❗ Answer SELECT SUM(population) FROM city WHERE countrycode = 'JPN'; 📌 Discussion where 절에서 조건에 맞는 레코드만 추출 후 sum 집계

SQL 문제풀이

[해커랭크 SQL] Aggregation - Average Population

❓ Question https://www.hackerrank.com/challenges/average-population Average Population | HackerRank Query the average population of all cities, rounded down to the nearest integer. www.hackerrank.com ❗ Answer SELECT FLOOR(AVG(population)) FROM city; 📌 Discussion avg로 집계 후 floor로 버림

SQL 문제풀이

[해커랭크 SQL] Aggregation - Revising Aggregations - Averages

❓ Question https://www.hackerrank.com/challenges/revising-aggregations-the-average-function Revising Aggregations - Averages | HackerRank Query the average population of all cities in the District of California. www.hackerrank.com ❗ Answer SELECT AVG(population) FROM city WHERE district='California'; 📌 Discussion where로 조건에 맞는 레코드 불러온 후 avg로 집계

SQL 문제풀이

[해커랭크 SQL] Aggregation - Revising Aggregations - The Sum Function

❓ Question https://www.hackerrank.com/challenges/revising-aggregations-sum Revising Aggregations - The Sum Function | HackerRank Query the total population of all cities for in the District of California. www.hackerrank.com ❗ Answer SELECT SUM(population) FROM city WHERE district='California'; 📌 Discussion where로 조건에 맞는 레코드 불러온 후 sum으로 집계

SQL 문제풀이

[해커랭크 SQL] Basic Join - Average Population of Each Continent

❓ Question https://www.hackerrank.com/challenges/average-population-of-each-continent Average Population of Each Continent | HackerRank Query the names of all continents and their respective city populations, rounded down to the nearest integer. www.hackerrank.com ❗ Answer SELECT country.continent, FLOOR(AVG(city.population)) FROM city INNER JOIN country ON city.countrycode = country.code GROUP ..

SQL 문제풀이

[해커랭크 SQL] Basic Join - African Cities

❓ Question https://www.hackerrank.com/challenges/african-cities African Cities | HackerRank Query the names of all cities on the continent 'Africa'. www.hackerrank.com ❗ Answer SELECT city.name FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.continent = 'Africa'; 📌 Discussion join 후 조건에 해당하는 레코드만 추출

SQL 문제풀이

[해커랭크 SQL] Basic Join - Population Census

❓ Question https://www.hackerrank.com/challenges/asian-population Population Census | HackerRank Query the sum of the populations of all cities on the continent 'Asia'. www.hackerrank.com ❗ Answer SELECT SUM(city.population) FROM city INNER JOIN country ON city.countrycode = country.code WHERE country.continent = 'ASIA'; 📌 Discussion INNER JOIN 후 조건을 걸어서 모든 인구를 합해주었다.

냄비짱
Until the Boiling Point