[문제]
[MySQL]
WITH order_timeline AS (
SELECT *
, RANK() OVER (PARTITION BY customer_id ORDER BY order_date ASC) AS rnk
FROM Delivery
)
SELECT ROUND(AVG(CASE WHEN order_date = customer_pref_delivery_date
THEN 1
ELSE 0
END) * 100, 2) AS immediate_percentage
FROM order_timeline
WHERE rnk = 1
'SQL > LeetCode' 카테고리의 다른 글
| [LeetCode] 1193. Monthly Transactions I (0) | 2025.02.19 |
|---|---|
| [LeetCode] 1179. Reformat Department Table (0) | 2025.02.19 |
| [LeetCode] 1164. Product Price at a Given Date (0) | 2025.02.19 |
| [LeetCode] 1158. Market Analysis I (0) | 2025.02.19 |
| [LeetCode] 1148. Article Views I (0) | 2025.02.19 |
