본문 바로가기

hackerrank mysql30

[MYSQL] New Companies ▶ SQL > Advanced Select > New Companies Problem Given the table schemas below, write a query to print the company_code, founder name, total number of lead managers, total number of senior managers, total number of managers, and total number of employees. Order your output by ascending company_code. Company_code founder의 이름 lead manager의 수 senior manager의 수 manager의 수 employee의 수 를 company_code로 .. 2022. 9. 30.
[MYSQL] Weather Observation Station 13 ▶ SQL > Aggregation > Weather Observation Station 13 Problem Query the sum of Northern Latitudes (LAT_N) from STATION having values greater than 38.7880 and less than 137.2345. Truncate your answer to 4 decimal places. → 38.7880보다 크고 137.2345보다 작은 LAT_N의 합을 구하고 4번째 자리에서 내림(turncate)해라 Input Format The STATION table is described as follows: My Answer SELECT TRUNCATE(SUM(LAT_N), 4) FROM STATION WH.. 2021. 8. 16.
[MYSQL] Weather Observation Station 2 ▶ SQL > Aggregation > Weather Observation Station 2 Problem Query the following two values from the STATION table: The sum of all values in LAT_N rounded to a scale of 2 decimal places. → LAT_N의 모든 값의 합을 소수점 2자리까지 반올림한 값 The sum of all values in LONG_W rounded to a scale of 2 decimal places. → LONG_W의 모든 값의 합을 소수점 2잘까지 반올림한 값 Input Format The STATION table is described as follows: where LAT_N is.. 2021. 8. 9.
[MYSQL] The Blunder ▶ SQL > Aggregation > The Blunder Problem Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's 0 key was broken until after completing the calculation. She wants your help finding the difference between her miscalculation (using salaries with any zeros removed), and the actual average salary. Write a query .. 2021. 5. 18.
[MYSQL] Population Density Difference ▶ SQL > Aggregation > Population Density Difference Problem Query the difference between the maximum and minimum populations in CITY. → 최대 POPULATION과 최소 POPULATION의 차이를 query 하라 Input Format The CITY table is described as follows: My Answer SELECT MAX(POPULATION) - MIN(POPULATION) FROM CITY NOTE MAX(필드명) : 필드값 중 가장 큰 값 MIN(필드명) : 필드값 중 가장 작은 값 문제에서 둘의 차이를 구하라고 했기 때문에 MAX 값에서 MIN 값을 빼주었다! 2021. 5. 13.
[MYSQL] Japan Population ▶ SQL > Aggregation > Japan Population Problem Query the sum of the populations for all Japanese cities in CITY. The COUNTRYCODE for Japan is JPN. Input Format The CITY table is described as follows: My Answer SELECT SUM(POPULATION) FROM CITY WHERE COUNTRYCODE = 'JPN' NOTE SUM(필드명) : 필드 값을 더할 때 사용하는 함수 COUNT(필드명) : NULL이 아닌 레코드의 수 COUNT(*)은 레코드의 개수를 나타내지만 SUM(*)은 오류 2021. 5. 13.
728x90