데이터

SQL 문제풀이

[해커랭크 SQL] Aggregation - Weather Observation Station 13

❓ Question https://www.hackerrank.com/challenges/weather-observation-station-13 Weather Observation Station 13 | HackerRank Query the sum of Northern Latitudes having values greater than 38.7880 and less than 137.2345, truncated to 4 decimal places. www.hackerrank.com ❗ Answer SELECT ROUND(SUM(lat_n),4) FROM station WHERE lat_n BETWEEN 38.7880 AND 137.2345; 📌 Discussion WHERE 절에서 BETWEEN으로 범위 조건..

SQL 문제풀이

[해커랭크 SQL] Aggregation - Weather Observation Station 2

❓ Question https://www.hackerrank.com/challenges/weather-observation-station-2 Weather Observation Station 2 | HackerRank Write a query to print the sum of LAT_N and the sum of LONG_W separated by space, rounded to 2 decimal places. www.hackerrank.com ❗ Answer SELECT ROUND(SUM(lat_n),2), ROUND(SUM(long_w),2) FROM station; 📌 Discussion 모든 lat_n과 long_w를 각각 합친 후 ROUND로 반올림하여 소수점 둘째자리까지 표현한다.

SQL 문제풀이

[해커랭크 SQL] Aggregation - Top Earners

❓ Question https://www.hackerrank.com/challenges/earnings-of-employees Top Earners | HackerRank Find the maximum amount of money earned by any employee, as well as the number of top earners (people who have earned this amount). www.hackerrank.com ❗ Answer SELECT months*salary, COUNT(*) FROM employee WHERE months*salary = (SELECT max(months*salary) FROM employee) GROUP BY months*salary; 📌 Discuss..

SQL 문제풀이

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

❓ Question https://www.hackerrank.com/challenges/revising-aggregations-the-count-function Revising Aggregations - The Count Function | HackerRank Query the number of cities having populations larger than 100000. www.hackerrank.com ❗ Answer SELECT COUNT(name) FROM city WHERE population > 100000; 📌 Discussion where에서 조건문을 걸어주고 count로 집계

SQL 문제풀이

[해커랭크 SQL] Aggregation - The Blunder

❓ Question https://www.hackerrank.com/challenges/the-blunder The Blunder | HackerRank Query the amount of error in Sam's result, rounded up to the next integer. www.hackerrank.com ❗ Answer SELECT ROUND(AVG(salary))-ROUND(AVG(replace(salary,'0',''))) FROM employees; 📌 Discussion replace로 salary column의 string data의 '0'을 ''으로 변경 AVG는 숫자로 구성된 문자열도 집계 가능 개별 평균값을 반올림한 값의 차이를 계산해줌

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로 버림

냄비짱
'데이터' 태그의 글 목록 (2 Page)