The Number of Employees Which Report to Each Employee | Leetcode 1731 | Crack SQL Interviews

  Рет қаралды 4,311

Learn With Chirag

Learn With Chirag

Күн бұрын

Пікірлер: 13
@learnwithchirag
@learnwithchirag 10 ай бұрын
Hey there! 👋 For more interesting content, tutorials, and updates, Feel free to connect with me on Instagram Handles :- @createwithchirag - instagram.com/createwithchirag/ @learn.with.chirag - instagram.com/learn.with.chirag/ LinkedIn: www.linkedin.com/in/chirag-sehgal-9200111b8/ Let's stay connected and keep the creativity flowing! 💡
@BlendTubeMix
@BlendTubeMix 3 ай бұрын
# Write your MySQL query statement below SELECT E1.employee_id,E1.name,COUNT(E2.reports_to) AS reports_count,ROUND(AVG(E2.age)) AS average_age FROM Employees E1, Employees E2 WHERE E1.employee_id = E2.reports_to GROUP BY E1.employee_id, E1.name ORDER BY E1.employee_id
@JashwanthRavi-dy7gy
@JashwanthRavi-dy7gy 2 ай бұрын
Very thanks❤
@apoorvpradhan5125
@apoorvpradhan5125 6 ай бұрын
Thank you bhaiya.
@prathamsharma4416
@prathamsharma4416 10 ай бұрын
nice one bro
@learnwithchirag
@learnwithchirag 10 ай бұрын
thanks a lot ! glad it was helpful ❤️
@divinepandit1815
@divinepandit1815 Жыл бұрын
Bhaiya ji kaisa pata hoga ki kon sa attribute kon se table se lena hai
@learnwithchirag
@learnwithchirag Жыл бұрын
It is usually based on our joining condition. You can also reverse it ( i.e take E1 as E2 and E2 as E1 ) it will still be the same. Try to dry run the code to get more insight. Write SELECT * and run the query once.
@prathamsharma4416
@prathamsharma4416 10 ай бұрын
@@learnwithchirag yeah , that helped me, its like 2 table joined with all attributes
@mohammedmaqdoom4410
@mohammedmaqdoom4410 8 ай бұрын
thanks chirag this side
@learnwithchirag
@learnwithchirag 8 ай бұрын
Keep Learning 🎊💯
@riteshchaudhary8755
@riteshchaudhary8755 8 ай бұрын
Hello brother,i want to ask one thing that why e2.age and e2.employee_id are used and when i use e1.employee_id or e1.age it is showing wrong answer.Can you explain why?
@vineetkarmakar2305
@vineetkarmakar2305 6 ай бұрын
when you use e1.employee_id and e1.age it takes the values from the first table and when you use e2.employee_id and e2.age it takes the value from the second table jo humne join kia hai first table ke uppar e1.age use karega to manager ki age ka average ajaega par humne unka age ka avg chahiye jo manager ko report kar rahe hai and humne count bhi un bando ko karna hai ki kitne bande manager ko report kar rahein hain not ki kitne manager hai jisko log report kar rahein hai
LeetCode SQL: 180. Consecutive Numbers (Using SELF JOIN)
7:17
Cloud Concepts By Chandra
Рет қаралды 267
MLV Prasad - LeetCode SQL [ EASY ] | 1633 | "Percentage of Users Attended a Contest" |
9:45
Data Science University - MLV Prasad
Рет қаралды 1,2 М.
36. Count Salary Categories | SQL Interview Questions and Answers
7:17
Start Practicing
Рет қаралды 1,7 М.