No video

SQL Interview Question - Solution (Part - IV)

  Рет қаралды 624

MeanLifeStudies

MeanLifeStudies

Күн бұрын

In this video, we solved a counter question that has been asked frequently in the most recent data engineer or data analyst interviews.
#interview #sqlwindowfunctions #datascience #sql #sqlfunctions
Here are My profiles that will definitely help your preparation for data analyst or data engineer roles.
Medium: / mahendraee204
Github: github.com/mah...
Q) Return Employee details who earn a higher salary than the average salary of all managers in the organization.
Table Creation and Insertion Statements:
------------------------------------------------------------------
create table employee (
empid int,
empname varchar(50),
mgrid int,
salary int
);
insert into employee values
(1, 'mahendra', 2, 25000),
(2, 'mahi', 5, 20000),
(3, 'sam', null, 45000),
(4, 'dev', 1, 20000),
(5, 'dash', 3, 97000),
(6, 'pratik', 6, 30000),
(7, 'singh', 2, 40000),
(8, 'rao', 5, 80000);

Пікірлер: 3
@Aditya61515
@Aditya61515 Ай бұрын
Thank You a Nice explanation keep going
@MeanLifeStudies
@MeanLifeStudies Ай бұрын
Thank you.
@VARUNTEJA73
@VARUNTEJA73 2 ай бұрын
1.select t.empid,t.empname,t.mngid,t.sal from test21 t join test21 v on t.mngid=v.empid where t.sal>v.sal 2.with cte as( select avg(totalsal)as totalavg from( select distinct v.sal as totalsal,v.mngid from test21 t join test21 v on t.mngid=v.empid)t1), cte1 as (select t.empid,t.empname,case when t.sal>totalavg then 1 else 0 end as varun from test21 t,cte group by t.empid,t.empname,t.sal,totalavg) select *from cte1 where varun=1
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 95 МЛН
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 78 МЛН
Data Analyst Interview 2024 | SQL | POWER BI | Data Science | Mock Interview
15:39
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 95 МЛН