본문 바로가기

CODING TEST/SQL : HackerRank31

[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] 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] Top Earners ▶ SQL > Aggregation > Top Earners Problem We define an employee's total earnings to be their monthly salary X months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as 2.. 2021. 5. 26.
[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.
728x90