Select del_partner , count( case when predicted_time < datediff(MINUTE,order_time,deliver_time) then 1 else null end) as Order_count from order_details group by del_partner
@pravinprince32213 ай бұрын
Thank you for the wonderful video mam
@kritiknagar60893 ай бұрын
Very supportive Content
@Team_Kanya_raasi3 ай бұрын
with cte as( select *, case when DATEDIFF(MINUTE,order_time,deliver_time) > predicted_time then 'yes' when DATEDIFF(MINUTE,order_time,deliver_time) < predicted_time then 'no' else 'on time_delivery' end flag from order_details ) select del_partner,count(cte.flag) delay_order_count from cte where cte.flag = 'yes' group by del_partner
@shedizon59783 ай бұрын
In the video the column order_date was not order_date but date, Thank GOD that at this age of mine, at 53 made it this far querying just for watching videos on KZbin! Thank You for your videos! and GOD Bless! SELECT del_partner, COUNT(*) AS order_count FROM order_details WHERE TIMESTAMPDIFF (MINUTE,CONCAT( DATE(order_date), ' ', order_time), CONCAT( DATE(order_date), ' ', deliver_time)) > predicted_time GROUP BY del_partner;
@radhikadaksh32512 ай бұрын
Good explanation
@sv18573 ай бұрын
Hey nishita I like your teaching pattern please give more questions for SQL joins and cte.
@shahzan5253 ай бұрын
Please post the video how count and min function working with partition/window functy
@hairavyadav65793 ай бұрын
I think without concat we also get excepted output because we need only delay order
@rajanchaurasiya1734Ай бұрын
with order_stat as( select *, timestampdiff(minute,order_time,deliver_time) as "time_diff", case when timestampdiff(minute,order_time,deliver_time) = predicted_time then "Not delayed" else "Delayed" end as "order_status" from order_details ) select del_partner, count(order_status) as "order_count" from order_stat where order_status = "Delayed" group by del_partner;
@ARUNVG-si5kt27 күн бұрын
with cte as( select *,DATEDIFF(MINUTE,order_time,deliver_time) as actual_time from order_details) select del_partner,count(orderid) as delayed_orders from cte where actual_time>predicted_time group by del_partner
@vikassolanki2972 ай бұрын
With cte as( select *, datediff(minute,order_time,deliver_time) as time_diff from order_detailss) select del_partner, count(*) from cte where time_diff > predicted_time group by del_partner
@DataToInfo2 ай бұрын
In dataset, the column name is 'order_date' not 'date'. Anyway, good example.
@Savenature6352 ай бұрын
select del_partner,sum(case when predicted_time < timestampdiff(minute,order_time,deliver_time) then 1 when predicted_time>= timestampdiff(minute,order_time,deliver_time)then 0 end) as delayed_orders from swiggy_order_details group by 1;
@Saloni_Deep3 ай бұрын
Thanks
@m-43-prateekkumar273 ай бұрын
Useful..
@arjundev49083 ай бұрын
with cte as(SELECT *, date_add(order_time,interval predicted_time minute) AS Actual_time from order_details),v1 as( select *, case when deliver_time
@rohit_vora2 ай бұрын
with cte as (select del_partner, round(extract(epoch from (deliver_time::time - order_time::time))/60) as totl_time, predicted_time from order_details) select del_partner, count(1) cnt from cte where totl_time > predicted_time group by 1
@Rahul-l8s7f3 ай бұрын
Hey, nishtha😀, amazing content. question: what to do when i am getting error like "not recognized built-in function name". thanks ♥
@dataenggstudiesАй бұрын
select del_partner, count(*) from order_details where timestampdiff(minute, order_time, deliver_time) > predicted_time group by del_partner ;
@iswaryanandini21713 ай бұрын
Where do you practice this with a live data set
@echodelta76802 ай бұрын
I often download the CSV file from KZbin descriptions of different channels, import it into Workbench and practice different types of queries. Also, you can directly access huge datasets on Google BigQuery on cloud and run SQL there itself. :) When I was teaching myself Power BI few months ago, I would export the result set generated in Workbench as CSV to Power BI for creating visualizations and dashboards. It used be good hands-on for data analytics pipeline. :)
@anshusharaf20193 ай бұрын
with cte as ( SELECT *, (strftime('%s', deliver_time) - strftime('%s', order_time)) / 60 AS difference_in_minutes FROM order_details ) select del_partner, count('*') as cnt from cte where predicted_time < difference_in_minutes GROUP by del_partner in SQL Online IDE you can replace (strftime('%s', deliver_time) - strftime('%s', order_time)) / 60 AS difference_in_minutes with "TIMESTAMPDIFF(SECOND, departure, arrival) AS difference"
@vishalmane31393 ай бұрын
Kya h ye
@SanjeevSingh-ep9huАй бұрын
Wow
@ganeshgani79883 ай бұрын
Please make video on Date analyst opening
@vishalmane31393 ай бұрын
0
@SnapMathShortsАй бұрын
My Approach : select del_partner, count(case when predicted_time < cast (EXTRACT(EPOCH FROM (deliver_time - order_time)) / 60 as int) then 1 end ) as order_count from order_details group by 1;
@echodelta76802 ай бұрын
What is the order of processing in following line? DENSE_RANK() OVER(PARTITION BY department ORDER BY salary DESC) Does the partitioning of departments happen first, followed by ordering of salaries within those partitions and finally ranking of rows? Or does it happen in some other order? Kindly enlighten.
@Iamthebestthing3 ай бұрын
Great. Pin to pin detail video
@yashmehta69202 ай бұрын
It's my solution which is lengthy compared to video explanation just because of i don't know about TIMESTAMPDIFF function WITH cte3 AS ( SELECT *, HOUR(TIME(deliver_time - order_time)) * 60 + MINUTE(TIME(deliver_time - order_time)) AS Actual_time FROM order_details ), cte4 AS ( SELECT *, CASE WHEN Actual_time > predicted_time THEN 'Delayed' ELSE 'On Time' END AS delivery_cat FROM cte3 ) SELECT del_partner, COUNT(delivery_cat) FROM cte4 WHERE delivery_cat = 'Delayed' GROUP BY del_partner; Please give feedback if you like..
@jatinjangir22933 ай бұрын
HI, Please find the below solution with cte as ( select a.*,del_partner as dp,EXTRACT(EPOCH FROM (deliver_time - order_time)) / 60 AS act_time_taken from order_details a) select dp as del_partner,count(case when a.act_time_taken > a.predicted_time then 'Delayed' end) order_count from cte a group by dp order by 1;
@Mind_hit3 ай бұрын
select del_partner,count(status) as order_count from( select *,case when round(time_to_sec(deliver_time-order_time)/60) predicted_time then 'delayed' else 'on time' end as status from order_details)as x where x.status='delayed' group by x.del_partner ;
@mohanbharadwaj76843 ай бұрын
solution in SQL server management: with cte as ( select city, order_time, del_partner,deliver_time, predicted_time, datediff(minute, order_time, deliver_time ) as time_diff from orders ) select del_partner, count(*) as cnt from cte where time_diff > predicted_time group by del_partner
@MubarakAli-qs9qq3 ай бұрын
Optimised solution best
@rushalishetty8600Ай бұрын
WITH CTE(SELECT *,TIMESTAMPDIFF(MINUTE,order_time,deliver_time) as del_min FROM order_details) SELECT del_partner,COUNT(*) FROM CTE WHERE predicted_time
@Rogeshwaran18 күн бұрын
I'm using this method because it is easy to understand.
@sagartayde11853 ай бұрын
select del_partner, count(*) as order_count from order_details where datediff(minute,order_time, deliver_time) > predicted_time group by del_partner
@saiteja-gb8ho3 ай бұрын
Here is solution in SQL Server: SELECT del_partner, SUM( CASE WHEN DATEDIFF(minute, order_time,deliver_time) >predicted_time then 1 else 0 END ) CNT FROM order_details group by del_partner
@HARSHRAJ-gp6ve3 ай бұрын
WITH cte AS ( SELECT del_partner, order_time, deliver_time, predicted_time FROM order_details ),cte1 as( SELECT cte.*, TIMESTAMPDIFF(MINUTE, order_time, deliver_time) AS x2 FROM cte ) select del_partner,COUNT(*) as order_count FROM cte1 where x2>predicted_time GROUP BY del_partner;