본문 바로가기

CODING TEST32

[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.
[Algorithm] 그리디(Greedy) 알고리즘 - Python, Kotlin 모든 내용은 이것이 취업을 위한 코딩테스트다(나동빈 저)의 내용을 정리한 것입니다. 그리디(Greedy) 알고리즘 '탐욕' 알고리즘 → 현재 상황에서 지금 당장 좋은 것만 고르는 방법 ∴ 매 순간 가장 좋아보이는 것을 선택하며, 현재의 선택이 나중에 미칠 영향은 고려하지 않음 이 알고리즘은 기준에 따라 좋은 것을 선택하는 알고리즘이기 때문에 문제에서 '가장 큰 순서대로', '가장 작은 순서대로'와 같은 기준을 제시해줌 → 이 기준은 정렬 알고리즘을 사용했을 때 만족할 수 있으므로 그리디는 정렬 알고리즘과 자주 함께 나온다! [ 알고리즘 순서 ] 해 선택(Selection Procedure) : 지금 당장의 최적의 해를 구하고, 이를 부분 해 집합에 추가함 정당성 검사(Feasibility Check) :.. 2021. 7. 7.
[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.
728x90