Intermediate SQL Tutorial | Having Clause

Intermediate SQL Tutorial | Having Clause

Alex The Analyst

4 года назад

175,027 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

techy Akram
techy Akram - 13.10.2023 14:47

appreciate your effort

Ответить
Ikharona John
Ikharona John - 29.09.2023 14:57

So short, yet so precise. Thank you Alex.

Ответить
Anthony Ingram
Anthony Ingram - 01.09.2023 09:55

It’s almost like you don’t like Toby as much as Micheal

Ответить
Jsurfer16
Jsurfer16 - 28.08.2023 05:06

Commenting for traction as I continue learning, thanks as always for the videos!

Ответить
Shreya Gupta
Shreya Gupta - 13.08.2023 08:13

Hi Alex,
Thanks for the great explaination.
When I run this :
select
jobTitle,
avg(Salary) as avg_salary
from
EmployeeSalary
group by 1
having avg(Salary) > 42000;
I get error "Each GROUP BY expression must contain at least one column that is not an outer reference."

But this works fine
select
jobTitle,
avg(Salary) as avg_salary
from
EmployeeSalary
group by JobTitle
having avg(Salary) > 42000;

Do you know why "group by 1" doesnt work here.

Ответить
Daddy ChicoBean
Daddy ChicoBean - 05.08.2023 10:36

Thank you Alex!

Ответить
Noha Sayed
Noha Sayed - 23.07.2023 23:19

realy amasing i love it

Ответить
Knight radar
Knight radar - 12.07.2023 14:51

why should the having clause come above the order by claus in the average salary case

Ответить
Germane
Germane - 25.05.2023 21:47

Alex, you're the real deal. Much love. Posterity willl definitely remember you

Ответить
Mateo Sabando
Mateo Sabando - 15.05.2023 21:22

I’m getting HR as well with 50K average salary with the last query. Anybody else?

Ответить
Frederick Fong
Frederick Fong - 16.04.2023 10:19

As I go through the contents. I am amazed and taking all these small steps at its strides. Thank you once again

Ответить
Anthony D
Anthony D - 05.04.2023 23:56

Thank you Alex!

Ответить
user1s6874ge6
user1s6874ge6 - 29.03.2023 23:35

brilliant sir

Ответить
Poonam Sharma
Poonam Sharma - 26.03.2023 18:32

I just have a question, can't we do HAVING count(JobTitle) even though we group by salary, isnt that possible? thank you

Ответить
Meeth Kumar
Meeth Kumar - 23.03.2023 09:41

Yo! What did Michael do to Toby in this video?

Ответить
Alaeddin Msetri
Alaeddin Msetri - 16.03.2023 17:53

Helpful and really good explanation

Ответить
Secret Nobody
Secret Nobody - 08.03.2023 08:36

Can someone explain to me why

SELECT JobTitle, AVG(Salary) AS avgsalary

FROM EmployeeDemographics
JOIN EmployeeSalary
ON EmployeeDemographics.EmployeeID = EmployeeSalary.EmployeeID
GROUP BY JobTitle
HAVING avgsalary > 45000
ORDER BY avgsalary


is not working and I have to change the HAVING avgsalary > 45000 to HAVING AVG(Salary) > 45000?
I just wanted to try other methods if I could use HAVING clause with the column names and not the (Argument)

Ответить
Shokoofeh Heidari
Shokoofeh Heidari - 08.03.2023 02:00

Great job! Thanks

Ответить