Average Time of Process per Machine | Leetcode 1661 | Crack SQL Interviews in 50 Qs #mysql

preview_player
Показать описание
Want to crack SQL interviews? Check out our latest video!!!

A 50-questions SQL study plan to ace any interview.
This tutorial will walk you through the solution in easy steps. This is an easy-level question from Leetcode.

Consistency is what transforms average into excellence.
So be consistent & keep Coding💻!!

Timecodes
0:00 - Introduction
0:10 - Question Explanation
2:15 - Understanding Concept with the help of Example
4:32 - Writing SQL Query (Method - 1)
7:16 - Explanation of the Query (Method - 1)
8:34 - Outro

Connect With Me -

#coding
#leetcode
#mysql
#sql
#interview
#sqlinterview
#sqlinterviewquestionsandanswers
#sql_server
#article
#learnwithchirag
#average
#time
#machine
#easy
Рекомендации по теме
Комментарии
Автор

Hey there! 👋 For more interesting content, tutorials, and updates, Feel free to connect with me on


Instagram Handles :-



Let's stay connected and keep the creativity flowing! 💡

learnwithchirag
Автор

people dont know how underrated this guy you deserve a lot bro

AyanAbbas-psxv
Автор

This course is excellent, Chirag! While I had solved those queries before, watching your videos has provided me with new insights and a deeper understanding. Some problems I had tackled using window functions never made me consider alternative solutions. After watching, I’m discovering even better approaches!

NahushAgrawal
Автор

This answer won't be able to pass all the test cases. Please correct the code

rushali-wl
Автор

1 test case is failing using this approach. i guess the below is better approach.

```sql
SELECT a1.machine_id,
round(AVG(a2.timestamp - a1.timestamp), 3) AS processing_time
FROM Activity a1
JOIN Activity a2
ON a1.machine_id = a2.machine_id
AND a1.process_id = a2.process_id
AND a1.activity_type = 'start'
AND a2.activity_type = 'end'
GROUP BY a1.machine_id;
```

siddhantprakash.
Автор

Hi @learnwithchirag how did you able to run the code to get output int grid format at 5:30

Krishnaeagle-exzj
Автор

sir i want ot be data analyst..guide me plz..
what topics
what project
where to find job
where to practice and which topic problems
which oyutube channel or source is good

jeevananuragi
Автор

Great explanation! I was trying a new approach and came across this query, the runtime of 197ms, beating 87.71%

SELECT a1.machine_id,
ROUND(AVG(a2.timestamp - a1.timestamp), 3) AS processing_time
FROM Activity a1
JOIN Activity a2
ON a1.machine_id = a2.machine_id
AND a1.process_id = a2.process_id
AND a1.activity_type = 'start'
AND a2.activity_type = 'end'
GROUP BY a1.machine_id;

baivabsarkar
Автор

hi sir im bit confuse in this line a1.timestamp < a2.timestamp

AwaisBaig-do
visit shbcf.ru