목록Tool/SQL 코딩테스트 풀이 (44)
홍동이의 성장일기
Sales Analysis III - LeetCode Can you solve this real interview question? Sales Analysis III - Table: Product +--------------+---------+ | Column Name | Type | +--------------+---------+ | product_id | int | | product_name | varchar | | unit_price | int | +--------------+---------+ pro leetcode.com SELECT s.product_id , p.product_name FROM sales s LEFT JOIN product p ON s.product_id = p.product_..
Customers Who Bought All Products - LeetCode Can you solve this real interview question? Customers Who Bought All Products - Table: Customer +-------------+---------+ | Column Name | Type | +-------------+---------+ | customer_id | int | | product_key | int | +-------------+---------+ There is no pri leetcode.com SELECT customer_id FROM customer GROUP BY customer_id HAVING COUNT(DISTINCT product..
Managers with at Least 5 Direct Reports - LeetCode Can you solve this real interview question? Managers with at Least 5 Direct Reports - Table: Employee +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | | department | varchar | | managerId | int | +- leetcode.com SELECT m.name as name FROM employee e INNER JOIN employee m ON e.managerId = ..
Game Play Analysis IV - LeetCode Can you solve this real interview question? Game Play Analysis IV - Table: Activity +--------------+---------+ | Column Name | Type | +--------------+---------+ | player_id | int | | device_id | int | | event_date | date | | games_played | int | +--------- leetcode.com WITH cte_login AS( SELECT player_id , DATEDIFF(event_date, MIN(event_date) OVER(PARTITION BY pl..
Trips and Users - LeetCode Can you solve this real interview question? Trips and Users - Table: Trips +-------------+----------+ | Column Name | Type | +-------------+----------+ | id | int | | client_id | int | | driver_id | int | | city_id | int | | status | enum | | request_at | leetcode.com 취소율은 금지되지 않은 사용자가 있는 취소된(클라이언트별 또는 드라이버별) 요청의 수를 해당일의 금지되지 않은 사용자가 있는 요청의 총 수로 나누어 계산됩니다. "2013-10-01"..
Department Highest Salary - LeetCode Can you solve this real interview question? Department Highest Salary - Table: Employee +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | name | varchar | | salary | int | | departmentId | int | +--------------+--- leetcode.com [풀이 1] 다중컬럼 서브쿼리 select d.name Department , e.name Employee , e.salary Salary from employee..
Employees Earning More Than Their Managers - LeetCode Can you solve this real interview question? Employees Earning More Than Their Managers - Table: Employee +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | | salary | int | | managerId | int | +------ leetcode.com Write an SQL query to find the employees who earn more than their managers..
Customers Who Never Order - LeetCode Can you solve this real interview question? Customers Who Never Order - Table: Customers +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | +-------------+---------+ In SQL, id is the primary key colu leetcode.com Write a solution to find all customers who never order anything. Return the result table in..
Reformat Department Table - LeetCode Can you solve this real interview question? Reformat Department Table - Table: Department +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | revenue | int | | month | varchar | +-------------+---------+ (id, month) is leetcode.com Reformat the table such that there is a department id column and a revenue column for each ..
Friend Requests II: Who Has the Most Friends - LeetCode Can you solve this real interview question? Friend Requests II: Who Has the Most Friends - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com with cte_unionall as( select requester_id as id from RequestAccepted union all select accepter_i..