Тёмный
Hitesh Damani
Hitesh Damani
Hitesh Damani
Подписаться
Rolling Avg. using SQL | Data Science Problem
14:16
2 месяца назад
Комментарии
@jatinjangir2293
@jatinjangir2293 9 дней назад
In what all cases we should use self join
@lakshmishree105
@lakshmishree105 24 дня назад
Thanks a lot making this video ,I was learning SQL How your recording video with voice and editing tools... please let us know
@willz2622
@willz2622 27 дней назад
Very good, keep making good tutorial mate
@akshitarora6596
@akshitarora6596 Месяц назад
Hi Hitesh, could you please bring some Swiggy Business analyst SQL problems ?
@bakebestrasoi
@bakebestrasoi Месяц назад
New subscriber
@bakebestrasoi
@bakebestrasoi Месяц назад
Support me
@KAVITAASHOKKUMARLALWANI
@KAVITAASHOKKUMARLALWANI Месяц назад
Pls explain Fish bone Analysis
@Ilovefriendswebseries
@Ilovefriendswebseries Месяц назад
can you please tell me the error in this code with cte as ( select year, round(avg(height),2) as avght from athletes where sex='M' and year between 1896 and 2016 group by year order by year asc) select year,avght, lag(avght,1,172.73) over() as prev_yr_avght, round(abs(avght-lag(avght,1,172.73) over()),2) as diff from cte ; year avght prev_yr_avght diff 2016 181.68 178 3.68 2012 178 184 6 2008 184 178 6 1996 178 182.5 4.5 1994 182.5 179 3.5 1992 179 175 4 1984 175 175.28 0.28 1924 175.28 179.25 3.97 1908 179.25 165 14.25 1904 165 174.5 9.5 1900 174.5 172.73 1.77
@souryadeepsingha5906
@souryadeepsingha5906 Месяц назад
Very Very helpful
@ishanshubham8355
@ishanshubham8355 Месяц назад
This is my attempt in MYSQL with cte as ( select week(invoicedate) as week_num,weekday(invoicedate) as wk_day, dayname(invoicedate) as dayname, sum(quantity*unitprice) as ttl_sale from early_sales group by 1,2,3 order by 1,2 ), cte2 as ( select week_num,sum(ttl_sale) as total_sale from cte group by 1), cte3 as ( select week_num,ttl_sale,dayname, first_value(ttl_sale) over(partition by week_num order by wk_day) as monday_value , last_value(ttl_sale) over(partition by week_num order by wk_day rows between unbounded preceding and unbounded following) as sunday_value, count(*) over(partition by week_num) as cnt from cte where dayname in ("sunday","monday")), cte4 as ( select distinct week_num,if(cnt=1 and dayname="monday",sunday_value=0,sunday_value) as sunday_value, if(cnt=1 and dayname="sunday",monday_value=0,monday_value) as monday_value from cte3) select cte4.week_num as week_num, round((monday_value/total_sale)*100,0) as percent_monday_sale, round((sunday_value/total_sale)*100,0) as percent_sunday_sale from cte4 inner join cte2 on cte4.week_num=cte2.week_num
@Ilovefriendswebseries
@Ilovefriendswebseries Месяц назад
another approach with cte as ( select state,cust_id,timestamp as start_time,lead(timestamp,1) over(partition by cust_id) as endtime from customer_activity),cte2 as ( select cust_id,timestampdiff(second,start_time,endtime)/3600 as hrs_present from cte where state=1) select distinct(cust_id),sum(hrs_present) over(partition by cust_id) as hrs from cte2;
@Ilovefriendswebseries
@Ilovefriendswebseries Месяц назад
another approach with cte as( select *,row_number() over(partition by user_id order by watched) as rnm from watch),cte2 as ( select *,count(video_id) over(partition by video_id) as cnt from cte where rnm<=3),cte3 as ( select distinct(video_id),count(cnt) as cnt from cte2 group by video_id order by count(cnt) desc),cte4 as( select *,dense_rank() over(order by cnt desc) rnk from cte3 ) select video_id,cnt from cte4 where rnk<=3;
@Ilovefriendswebseries
@Ilovefriendswebseries Месяц назад
excellent model
@hrishikeshXXV
@hrishikeshXXV Месяц назад
"uh uh uh uh uh uh " thoda kam kijiye boht aage jayenge
@manojdevareddy8831
@manojdevareddy8831 Месяц назад
Tricky but got it thanks 😊
@rakeshkoli4384
@rakeshkoli4384 Месяц назад
can i ask u?
@hiteshdamani30
@hiteshdamani30 Месяц назад
Sure you can ping me on linkedin or you can share your queries on hiteshdamani30@gmail.com
@rakeshkoli4384
@rakeshkoli4384 Месяц назад
bro i need help as data analyst sql interview
@abhisharma3497
@abhisharma3497 Месяц назад
Your SQL skills and level of problem solving is very good. Your examples are practical and quiet advanced keep up the high complexity level.
@hiteshdamani30
@hiteshdamani30 Месяц назад
Glad you like them! Thank you so much
@rdxwtf
@rdxwtf Месяц назад
First viewer
@akshitarora6596
@akshitarora6596 Месяц назад
Hey Hitesh, thanks for sharing this. Your videos have been really helpful. Keep uploading more often!
@hiteshdamani30
@hiteshdamani30 Месяц назад
Thank you so much for your kind words! I'm glad you find my videos helpful. I'll definitely keep uploading more content regularly!
@tarakdarapu6183
@tarakdarapu6183 2 месяца назад
In second cte query you are using first_usage=month ,but it only give rows if only for the customers with first date right
@samw2066
@samw2066 2 месяца назад
Great video, but its too hard to hear you speak
@firdosesyed8981
@firdosesyed8981 2 месяца назад
unable to find the dataset
@hiteshdamani30
@hiteshdamani30 2 месяца назад
I've updated the link. Pls check now.
@hanifmmufid27
@hanifmmufid27 2 месяца назад
Thank you, good explanation
@ashishyadav-mf4hp
@ashishyadav-mf4hp 2 месяца назад
you know what I liked the most / made me click 1st the video is under 10mins , 2nd amazon , 3rd which was a surprise was the explaination
@hiteshdamani30
@hiteshdamani30 2 месяца назад
Thank you so much for your kind words. 🙏 Glad to know that this was useful to you. Soon I will be coming up with a series on python... Stay Tuned.
@Rahulrisin
@Rahulrisin 3 месяца назад
Very low voice
@rishykusuma5720
@rishykusuma5720 3 месяца назад
For median of odd num (n+1)/2 but here in query you have given (1*n)/2
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Yes, the mathematical formula of median for odd nos. Is (n+1)/2 but when we implement the logic of median in sql, as you can see we've used the round function which does the same thing. For an instance, Here n = 135 n/2 = 67.2 Round (n/2) = 68 And when we implement the same in mathematical formula it will be (n+1)/2, which is (135+1)/2 = 136/2 = 68. Both of these will give the same result. Hope this answers your question.
@rishykusuma5720
@rishykusuma5720 3 месяца назад
Got it thanks for the explanation
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Link to the Dataset have been added in the Description
@firdosesyed8981
@firdosesyed8981 3 месяца назад
hi please try to share the data also it's very helpful
@hiteshdamani30
@hiteshdamani30 2 месяца назад
I've added link of the dataset in description section
@rishykusuma5720
@rishykusuma5720 3 месяца назад
Great explanation 👏 Small suggestion please increase the font size it will be easy to view in mobile
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Thanks for shaing the Feedback 👍 Will start implementing
@firdosesyed8981
@firdosesyed8981 3 месяца назад
first view and like by me
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Thanks for your support
@devkaranjangid6368
@devkaranjangid6368 3 месяца назад
Well explained....Thanks
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Thank you 😊
@CodeWithLogicalPradip
@CodeWithLogicalPradip 3 месяца назад
Very good explanation and content.. plz make more videos same..
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Thanks for the feedback! Will come up with more such problems
@Cherupakstmt
@Cherupakstmt 3 месяца назад
Can you please share the dataset
@hiteshdamani30
@hiteshdamani30 2 месяца назад
Added in the Description section
@Cherupakstmt
@Cherupakstmt 3 месяца назад
Thanks for bringing good sql coding questions
@hiteshdamani30
@hiteshdamani30 3 месяца назад
Glad that you've found it useful!!! Do share it with others who are in need of this
@Cherupakstmt
@Cherupakstmt 3 месяца назад
Thanks for explaining the concept
@Cherupakstmt
@Cherupakstmt 4 месяца назад
Good question
@raghibelahi937
@raghibelahi937 4 месяца назад
Way of explanation 💯 Thank you for valuable content.
@hiteshdamani30
@hiteshdamani30 4 месяца назад
Glad you liked it!
@souryadeepsingha5906
@souryadeepsingha5906 4 месяца назад
Subscribed
@realbakersajmer
@realbakersajmer 4 месяца назад
Well done👍🏻