본문 바로가기

hackerrank28

[MYSQL] Placements ▶ SQL > Advanced Join > Placements Problem You are given three tables: Students, Friends and Packages. Students contains two columns: ID and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best friend). Packages contains two columns: ID and Salary (offered salary in $ thousands per month). Write a query to output the names of those students whose best friends got offered a h.. 2022. 10. 5.
[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] 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] Average Population ▶ SQL > Aggregation > Average Population Problem Query the average population for all cities in CITY, rounded down to the nearest integer. Input Format The CITY table is described as follows: My Answer SELECT ROUND(AVG(POPULATION)) FROM CITY NOTE ROUND 함수 : 반올림 ROUND(컬럼명) - 소수점 1번째 자리에서 반올림 (123.7 → 124) ROUND(컬럼명, 1) - 출력할 소수점 자리 지정 (123.75 → 123.8) ROUND(컬럼명, -1) - 10단위로 반올림 (123 → 120) TRUNCA.. 2021. 4. 21.
[MySQL] Revising Aggregations - Averages ▶ SQL > Aggregation > Revising Aggregations - Averages Problem Query the average population of all cities in CITY where District is California. Input Format The CITY table is described as follows: My Answer SELECT AVG(POPULATION) FROM CITY WHERE DISTRICT = 'California' 2021. 4. 20.
728x90