Тёмный

SQL Interview Question - Solution (Part - IV)  

MeanLifeStudies
Подписаться 940
Просмотров 514
50% 1

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/mahendra204
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);

Опубликовано:

 

18 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@Aditya61515
@Aditya61515 24 дня назад
Thank You a Nice explanation keep going
@MeanLifeStudies
@MeanLifeStudies 24 дня назад
Thank you.
@VARUNTEJA73
@VARUNTEJA73 Месяц назад
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
Далее
Practice SQL Interview Query | Big 4 Interview Question
14:47