데이터

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 후 조건을 걸어서 모든 인구를 합해주었다.

SQL 문제풀이

[해커랭크 SQL] Advanced Select - The PADS

❓ Question https://www.hackerrank.com/challenges/the-pads The PADS | HackerRank Query the name and abbreviated occupation for each person in OCCUPATIONS. www.hackerrank.com ❗ Answer SELECT CONCAT(name,'(',LEFT(occupation,1),')') FROM occupations ORDER BY name; SELECT CONCAT('There are a total of ' , a.cnt, ' ', LOWER(a.occupation), IF(cnt>=2,'s.','.')) FROM (SELECT occupation, COUNT(*) cnt FROM ..

SQL 문제풀이

[해커랭크 SQL] Advanced Select - Type of Triangle

❓ Question https://www.hackerrank.com/challenges/what-type-of-triangle Type of Triangle | HackerRank Query a triangle's type based on its side lengths. www.hackerrank.com ❗ Answer SELECT (CASE WHEN a>=b+c OR b>=c+a OR c>=a+b THEN 'Not A Triangle' WHEN a=b AND b=c THEN 'Equilateral' WHEN (a=b AND b!=c) OR (b=c AND c!=a) OR (c=a AND a!=b) THEN 'Isosceles' ELSE 'Scalene' END) FROM triangles; 📌 Disc..

SQL 문제풀이

[해커랭크 SQL] Basic Select - Employee Salaries

❓ Question https://www.hackerrank.com/challenges/salary-of-employees Employee Salaries | HackerRank Print the names of employees who earn more than $2000 per month and have worked at the company for less than 10 months. www.hackerrank.com ❗ Answer SELECT name FROM employee WHERE salary > 2000 AND months < 10 ORDER BY employee_id; 📌 Discussion - WHERE 에서 salary와 months에서 두가지 조건을 걸어줌

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