All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g1101_1200.s1174_immediate_food_delivery_ii.script.sql Maven / Gradle / Ivy

The newest version!
# Write your MySQL query statement below
# #Medium #Database #2023_08_12_Time_1205_ms_(78.39%)_Space_0B_(100.00%)
SELECT ROUND(AVG(CASE WHEN customer_pref_delivery_date = order_date THEN 1 ELSE 0 END) * 100, 2) AS immediate_percentage
FROM (
    SELECT *,
           DENSE_RANK() OVER(PARTITION BY customer_id ORDER BY order_date ASC) AS dnsrnk
    FROM delivery
) subquery_alias
WHERE subquery_alias.dnsrnk = 1;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy