본문 바로가기

취준/코팅 테스트20

[LeetCode] - 1070.Product Sales Analysis 3 문제 Write a solution to select the product id, year, quantity, and pricefor the first year of every product sold. Return the resulting table in any order. The result format is in the following example. "판매되는 모든 제품의 첫 해 제품 id, 연도, 수량, 가격을 선택할 수 있는 솔루션을 작성하시오." 풀이 과정 SELECT product_id, year AS first_year, quantity, price FROM sales WHERE (product_id,year) IN (SELECT product_id,min(year) AS year FRO.. 2024. 4. 15.
[LeetCode] 1084. Sales Analysis 3 문제 Write a solution to report the products that were only sold in the first quarter of 2019. That is, between 2019-01-01 and 2019-03-31 inclusive. Return the result table in any order. "2019년 1분기에만 판매된 제품을 알 수 있는 쿼리를 작성해라 즉, 2019-01-01 부터 2019-03-01 사이에 포함된다." 문제 풀이 product_id 별로 날짜를 확인 해야 한다. 이때 중요하건 product_id 모두가 1분기 날짜에 팔려야 한다. 즉, 1개라도 1분기 날자 이후에 판매된 경우는 제외되어야 한다. SELECT s.product_id , p.pro.. 2024. 4. 10.
[LeetCode] - 608. Tree Node 문제 Each node in the tree can be one of three types: "Leaf": if the node is a leaf node."Root": if the node is the root of the tree."Inner": If the node is neither a leaf node nor a root node. Write a solution to report the type of each node in the tree. Return the result table in any order. " Leef, Root, Inner로 분류하여라" 문제 풀이 1) Root의 경우는 p_id가 Null 인 경우이다. 2) Inner의 경우는 P-id가 id에 속해 있어야 하고, id도 역.. 2024. 4. 10.
[LeetCode] - 1965. Employees With Missing Information 문제 Write a solution to report the IDs of all the employees with missing information. The information of an employee is missing if: The employee's name is missing, orThe employee's salary is missing. Return the result table ordered by employee_id in ascending order. " 누락된 정보가 있는 모든 직원의 ID를 보고하는 솔루션을 작성합니다. 다음과 같은 경우에는 직원의 정보가 누락됩니다 1. 직원의 이름이 누락되었거나, 2. 직원의 급여가 누락되었습니다. employee_id에서 주문한 결과표를 오름차.. 2024. 4. 9.