1) with cte as (select *, DATEDIFF(MINUTE ,order_time, deliver_time) as time_diff from swiggy_orders ) select del_partner,sum(case when time_diff>predicted_time then 1 else 0 end ) as cn from cte group by del_partner 2) with cte as( select * from sales_data where product_id=4), cte2 as( select order_date , sum(order_value) as s from cte group by order_date ), cte3 as( select order_date, dense_rank() over(order by s desc) as rn, s from cte2 ) select order_date , s from cte3 where rn=3
select del_partner,count(*)delay_count from ( select * , iif((DATEPART(HOUR,deliver_time)-DATEPART(HOUR,order_time))=1,60+DATEPART(MINUTE,deliver_time),DATEPART(MINUTE,deliver_time)) actual_time from swiggy_orders) sq where actual_time> predicted_time group by del_partner By this way I did it am I correct if yes please let me know sir Thanks. with cte as (select *,rank() over(order by val desc) rank from ( select order_date,sum(order_value) val from sales_data where product_id = 4 group by order_date) s2) select * from cte where rank = 3
Namastesql website videos not working The media could not be loaded, either because the server or network failed or because the format is not supported Unable to play the course videos
Do like the video for more recent interview questions🙏
1) with cte as (select *,
DATEDIFF(MINUTE ,order_time, deliver_time) as time_diff from swiggy_orders
)
select del_partner,sum(case when time_diff>predicted_time then 1 else 0 end ) as cn
from cte
group by del_partner
2) with cte as(
select * from sales_data where product_id=4),
cte2 as(
select order_date , sum(order_value) as s
from cte group by order_date ),
cte3 as(
select order_date, dense_rank() over(order by s desc) as rn, s
from cte2
)
select order_date , s from cte3 where rn=3
select del_partner,count(*)delay_count from (
select * ,
iif((DATEPART(HOUR,deliver_time)-DATEPART(HOUR,order_time))=1,60+DATEPART(MINUTE,deliver_time),DATEPART(MINUTE,deliver_time)) actual_time
from swiggy_orders) sq
where actual_time> predicted_time
group by del_partner
By this way I did it am I correct if yes please let me know sir
Thanks.
with cte as (select *,rank() over(order by val desc) rank from
(
select order_date,sum(order_value) val from sales_data
where product_id = 4
group by order_date) s2)
select * from cte
where rank = 3
Conversation failed when converting date and time from character string?
Type cast the column
Namastesql website videos not working
The media could not be loaded, either because the server or network failed or because the format is not supported
Unable to play the course videos
Looking into it