#95. [LeetCode / MySQL] 1174. Immediate Food Delivery II

문제

 

입력 코드

SELECT 
    ROUND(AVG(order_date = customer_pref_delivery_date) * 100, 2) AS immediate_percentage
FROM Delivery
WHERE (customer_id, order_date) IN (
  SELECT customer_id, MIN(order_date) 
  FROM Delivery
  GROUP BY customer_id
)

 

 

코드 설명

#SELECT #ROUND #AVG #MIN #GROUP BY #SUBQUERY

 

 

문제 출처

 

Immediate Food Delivery II - LeetCode

Can you solve this real interview question? Immediate Food Delivery II - Table: Delivery +-----------------------------+---------+ | Column Name | Type | +-----------------------------+---------+ | delivery_id | int | | customer_id | int | | order_date | d

leetcode.com