hey bro i have been following u for some time now , u are amazing at SQL just one request if u could use excel for showing how the tables will look if we join them it will be much easier to understand . thank you
That’s a great suggestion, Pankaj. Definitely, I’ll use Excel to showcase joins starting from the videos I start recording today. Thanks for such kind words & valuable suggestion. Glad that you are liking the videos 😊
Yes, every question can be solved in multiple ways. You can do this using CASE WHEN THEN END statement as well. The logic would be GROUP BY machine_id, process_id and then use CASE WHEN for activity_type column to calculate start and end time and subtract them. Hint: You might have to use SUM() along with it to make it work.
hey bro i have been following u for some time now , u are amazing at SQL just one request if u could use excel for showing how the tables will look if we join them it will be much easier to understand . thank you
That’s a great suggestion, Pankaj. Definitely, I’ll use Excel to showcase joins starting from the videos I start recording today. Thanks for such kind words & valuable suggestion. Glad that you are liking the videos 😊
This was super helpful thank you
This was a tricky question definitely not easy. Can you tell me if we can do this using CASE WHEN statement?
Yes, every question can be solved in multiple ways. You can do this using CASE WHEN THEN END statement as well. The logic would be GROUP BY machine_id, process_id and then use CASE WHEN for activity_type column to calculate start and end time and subtract them.
Hint: You might have to use SUM() along with it to make it work.
@@EverydayDataScience cool, thanks I'll look into it.
@@EverydayDataScience what do you think is the best process to learn and understand logic of SQL?
why used * in count, * is for all coulmns right?
No, we used a group by function hence it will give a count of grouped rows.