Important SQL INTERVIEW question | Difference between where and having in mysql

  ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 43,656

Sumit Mittal

Sumit Mittal

ะšาฏะฝ ะฑาฑั€ั‹ะฝ

๐–๐š๐ง๐ญ ๐ญ๐จ ๐Œ๐š๐ฌ๐ญ๐ž๐ซ ๐’๐๐‹? ๐‹๐ž๐š๐ซ๐ง ๐’๐๐‹ ๐ญ๐ก๐ž ๐ซ๐ข๐ ๐ก๐ญ ๐ฐ๐š๐ฒ ๐ญ๐ก๐ซ๐จ๐ฎ๐ ๐ก ๐ญ๐ก๐ž ๐ฆ๐จ๐ฌ๐ญ ๐ฌ๐จ๐ฎ๐ ๐ก๐ญ ๐š๐Ÿ๐ญ๐ž๐ซ ๐œ๐จ๐ฎ๐ซ๐ฌ๐ž - ๐’๐๐‹ ๐‚๐ก๐š๐ฆ๐ฉ๐ข๐จ๐ง๐ฌ ๐๐ซ๐จ๐ ๐ซ๐š๐ฆ ๐›๐ฒ ๐’๐ฎ๐ฆ๐ข๐ญ ๐’๐ข๐ซ!
"๐€ 8 ๐ฐ๐ž๐ž๐ค ๐๐ซ๐จ๐ ๐ซ๐š๐ฆ ๐๐ž๐ฌ๐ข๐ ๐ง๐ž๐ ๐ญ๐จ ๐ก๐ž๐ฅ๐ฉ ๐ฒ๐จ๐ฎ ๐œ๐ซ๐š๐œ๐ค ๐ญ๐ก๐ž ๐ข๐ง๐ญ๐ž๐ซ๐ฏ๐ข๐ž๐ฐ๐ฌ ๐จ๐Ÿ ๐ญ๐จ๐ฉ ๐ฉ๐ซ๐จ๐๐ฎ๐œ๐ญ ๐›๐š๐ฌ๐ž๐ ๐œ๐จ๐ฆ๐ฉ๐š๐ง๐ข๐ž๐ฌ ๐›๐ฒ ๐๐ž๐ฏ๐ž๐ฅ๐จ๐ฉ๐ข๐ง๐  ๐š ๐ญ๐ก๐จ๐ฎ๐ ๐ก๐ญ ๐ฉ๐ซ๐จ๐œ๐ž๐ฌ๐ฌ ๐š๐ง๐ ๐š๐ง ๐š๐ฉ๐ฉ๐ซ๐จ๐š๐œ๐ก ๐ญ๐จ ๐ฌ๐จ๐ฅ๐ฏ๐ž ๐š๐ง ๐ฎ๐ง๐ฌ๐ž๐ž๐ง ๐๐ซ๐จ๐›๐ฅ๐ž๐ฆ."
๐‡๐ž๐ซ๐ž ๐ข๐ฌ ๐ก๐จ๐ฐ ๐ฒ๐จ๐ฎ ๐œ๐š๐ง ๐ซ๐ž๐ ๐ข๐ฌ๐ญ๐ž๐ซ ๐Ÿ๐จ๐ซ ๐ญ๐ก๐ž ๐๐ซ๐จ๐ ๐ซ๐š๐ฆ -
๐‘๐ž๐ ๐ข๐ฌ๐ญ๐ซ๐š๐ญ๐ข๐จ๐ง ๐‹๐ข๐ง๐ค (๐‚๐จ๐ฎ๐ซ๐ฌ๐ž ๐€๐œ๐œ๐ž๐ฌ๐ฌ ๐Ÿ๐ซ๐จ๐ฆ ๐ˆ๐ง๐๐ข๐š) : rzp.io/l/SQLINR
๐‘๐ž๐ ๐ข๐ฌ๐ญ๐ซ๐š๐ญ๐ข๐จ๐ง ๐‹๐ข๐ง๐ค (๐‚๐จ๐ฎ๐ซ๐ฌ๐ž ๐€๐œ๐œ๐ž๐ฌ๐ฌ ๐Ÿ๐ซ๐จ๐ฆ ๐จ๐ฎ๐ญ๐ฌ๐ข๐๐ž ๐ˆ๐ง๐๐ข๐š) : rzp.io/l/SQLUSD
๐–๐š๐ง๐ญ ๐ญ๐จ ๐ฅ๐ž๐š๐ซ๐ง ๐๐ข๐  ๐ƒ๐š๐ญ๐š ๐›๐ฒ ๐’๐ฎ๐ฆ๐ข๐ญ ๐’๐ข๐ซ?
๐œ๐ก๐ž๐œ๐ค๐จ๐ฎ๐ญ ๐ญ๐ก๐ž ๐›๐ข๐  ๐๐š๐ญ๐š ๐œ๐จ๐ฎ๐ซ๐ฌ๐ž ๐๐ž๐ญ๐š๐ข๐ฅ๐ฌ
๐–๐ž๐›๐ฌ๐ข๐ญ๐ž : trendytech.in/?src=youtube&su...
I have trained over 20,000+ professionals in the field of Data Engineering in the last 5 years.
In this video we will talk about the difference between WHERE and HAVING clause in MYSQL. This is a very important question from interview point of view also.
Do Like, Comment & Subscribe :)
๐—๐—ผ๐—ถ๐—ป ๐—บ๐—ฒ ๐—ผ๐—ป ๐—ฆ๐—ผ๐—ฐ๐—ถ๐—ฎ๐—น ๐— ๐—ฒ๐—ฑ๐—ถ๐—ฎ:๐Ÿ”ฅ
๐Ÿ”…Sumit LinkedIn - / bigdatabysumit
๐Ÿ”…Sumit Instagram - / bigdatabysumit
Where vs Having clause in SQL
==============================
select source_of_joining,count(*) as total from students group by source_of_joining;
I want to know the lead sources through with more than 1 person has registered.
select source_of_joining,count(*) as total from students group by source_of_joining where total gt 1;
where clause is used to filter the individual records before aggregation..
select source_of_joining,count(*) as total from students group by source_of_joining having total gt 1;
// I want to know the count of people who registered through linkedIN
select source_of_joining,count(*) as total from students group by source_of_joining having source_of_joining = 'linkedin';
select source_of_joining,count(*) as total from students where source_of_joining = 'linkedin' group by source_of_joining;
can we use where and having in same query
==========================================
//the locations from which more than 1 student has joined & the students experience is more than 10 years
select location,count(*) as total from students where years_of_exp gt 10 group by location having total gt 1;
where is used before group by and do filtering on individual records
having is used after group by and do filtering on aggregated records.
we can use where and having in the same query also.
where is more performant than having.
#SQL #RDBMS #database #bigdata #dataengineering

ะŸั–ะบั–ั€ะปะตั€: 37
@sumitmittal07
@sumitmittal07 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Checkout the Big Data course details here: trendytech.in/?referrer=youtube_sql13
@rahultewari8354
@rahultewari8354 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
sir in last query if we also want to print years_of_exp then what will we do . select location,years_of_exp,count(*) as total from student where years_of_exp>10 group by location having total>1; # its giving error
@arnabpati2724
@arnabpati2724 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
@@rahultewari8354 the corrected query will be: select location, years_of_exp, count(*) as total from students where years_of_exp > 10 group by location, years_of_exp having total > 1; It will not give any error but can give null if no such records are present or exist.
@bharathKumar-or6gd
@bharathKumar-or6gd ะะน ะฑาฑั€ั‹ะฝ
Clear and Great Explanation on Where and Having Clause ๐Ÿ‘Œ๐Ÿ‘Œ๐Ÿ‘Œ๐Ÿ‘Œ
@rashmibhardwaj1254
@rashmibhardwaj1254 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
I couldn't find this much clarity in any of the explanations available on the internet. ๐Ÿ™‚
@greatmonk
@greatmonk ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Thank you Sir.. This was a wonderful session.. You have rightfully curated the program and touch-based the missing points.. Thank you again!!!!!!!!
@smyphysics
@smyphysics 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Great sir (SQL session 12 _Difference between where and having in mysql)
@farzicoder8905
@farzicoder8905 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
What a great explanation, that made it crystal clear.
@vishnujatav6329
@vishnujatav6329 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Very much useful. Thanks a lot
@amanhayaran1152
@amanhayaran1152 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
nicely and clearly explained sir Loved this series
@TrustinData
@TrustinData ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Awesome explanation sir
@ravimishra339
@ravimishra339 8 ะฐะน ะฑาฑั€ั‹ะฝ
Awesome explanation.
@sagnikchakraborty734
@sagnikchakraborty734 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Sir you are the best teacher I ever learned from....
@khaan119
@khaan119 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Have u get job ??
@dkkashyap6494
@dkkashyap6494 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Undoubtedly one of the best courses.... But due to limitation of dataset its lacking a bit,,,, You should have used the provided schemas in Mysql... just a suggestion\
@ripulchhabra5686
@ripulchhabra5686 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
was waiting โœ‹
@Kush6542
@Kush6542 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
thanks a lot sir. very useful
@sumitmittal07
@sumitmittal07 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Happy to hear that you found the content useful :)
@abhishekkatara7584
@abhishekkatara7584 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Wonderful explanation of both Where and Having clause, liking the entire series Sumit Sir.
@sumitmittal07
@sumitmittal07 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
I am happy to hear that you are liking the explanation :)
@saurabhpandey7603
@saurabhpandey7603 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Good explanation
@sayalipatkar2755
@sayalipatkar2755 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
great videos
@poojachavan4091
@poojachavan4091 9 ะฐะน ะฑาฑั€ั‹ะฝ
thank you sir
@chanduyj
@chanduyj 7 ะบาฏะฝ ะฑาฑั€ั‹ะฝ
Sir can you please share the notes which you were saved in your notepad while Explaining
@santoshatyam1409
@santoshatyam1409 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
We can't use alias name in having clause such as total. Why it is not throwing error in SQL server it will give error
@harshrajvaghela699
@harshrajvaghela699 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
sir plese roll about cloud computing in big data
@aakashsrivastava9808
@aakashsrivastava9808 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
hello sir i have a followup question regarding the last query .. select source_of_joining,count(*) as total from employee where exp>3 group by source_of_joining having total>2; this query chaecks the source_of_joining having total >2 after filtering exp>3 what if we want to check the source_of_joining having total >2 and after that check exp>3.. I am trying to do it like this but it is showing errror select source_of_joining,count(*) as total from employee group by source_of_joining having total>2 where exp>3;
@nitinrao1133
@nitinrao1133 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
No, this is won't work like the way yu want to execute. Where always execute before the group by statement.
@therisingsinger4330
@therisingsinger4330 4 ะฐะน ะฑาฑั€ั‹ะฝ
โ€‹@@nitinrao1133 correct ๐Ÿ’ฏ
@therisingsinger4330
@therisingsinger4330 4 ะฐะน ะฑาฑั€ั‹ะฝ
Is anyone can please tell me , why there is applied ... Having total >1; I got confused
@ashishthakur8619
@ashishthakur8619 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Can we get the document that u used
@NAVEENKUMAR-nd7jg
@NAVEENKUMAR-nd7jg ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
happy ending cool sir cool my god live long?
@khaan119
@khaan119 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Have u get job help with this sql course
@sharmisaha9655
@sharmisaha9655 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
self join is not covered
@satyajeet4450
@satyajeet4450 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Q1a. Display the total no. of students joined from each source & the lead sources through which more than 1 person has registered ----> SELECT source_of_joining,count(*) AS TOTAL from students GROUP BY source_of_joining HAVING TOTAL > 1; b. Display the count of people who registered through linkedIN. ----> SELECT source_of_joining,count(*) AS TOTAL from students GROUP BY source_of_joining = 'linkedIN'; Q2. The locations from which more than 1 student has joined & students having more than 10 years of experience. ----> SELECT location, count(*) AS TOTAL from students where years_of_experience > 10 GROUP BY location HAVING TOTAL > 1;
@tashi9154
@tashi9154 ะ–ั‹ะป ะฑาฑั€ั‹ะฝ
Q1. b is incorrect ig
@amitpandey7493
@amitpandey7493 2 ะถั‹ะป ะฑาฑั€ั‹ะฝ
Hindi mein kuch vichar kare sir
Very Important SQL Interview question  | Over Clause | Partition By Clause
17:35
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 60 ะœ.
SQL session 10 | Logical Operators | Trendytech
27:29
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 38 ะœ.
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 13 ะœะ›ะ
Was ist im Eis versteckt? ๐ŸงŠ Coole Winter-Gadgets von Amazon
00:37
SMOL German
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 39 ะœะ›ะ
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 58 ะœะ›ะ
100โค๏ธ
00:19
MY๐Ÿ’No War๐Ÿค
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 22 ะœะ›ะ
Joins in SQL - very important for interviews | SQL session 11 | Trendytech
32:47
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 65 ะœ.
๐Ÿ”ฅะ ะฐะทะฑะธั€ะฐะตะผ SQL ะฝะฐ ะฟั€ะธะผะตั€ะต PostgreSQL - SELECT, JOIN, GROUP, HAVING, Coalesce ะธ ะดั€.
40:55
ะ”ะธะดะถะธั‚ะฐะปะธะทะธั€ัƒะน!
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 594 ะœ.
SQL JOINS Interview Question | What does different SQL Joins return?
25:17
techTFQ
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 402 ะœ.
Row Number Function in MySQL | Important SQL Interview Question
15:02
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 48 ะœ.
22 -GROUP BY Clause in SQL | Use Of GROUP BY | Interview Questions | Examples | Multiple Column| SQL
13:03
CodeEra
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 6 ะœ.
Leetcode SQL Interview Questions  | Practise SQL questions
17:50
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 21 ะœ.
SQL interview Questions and Answers | Frequently asked SQL interview questions | Sql Mock Interview
16:45
Lotus IT Hub training institute
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 35 ะœ.
Learn SQL the right way - session 3 | Primary Key vs Unique Key | Trendytech
26:48
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 95 ะœ.
3 Very Important SQL Interview Questions on LeetCode | Practise SQL Questions
23:43
Sumit Mittal
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 35 ะœ.
24-Difference Between WHERE and HAVING CLAUSE in SQL | Examples | Most Important Interview Question
6:17
CodeEra
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 4,5 ะœ.
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
ะ ะตั‚ า›ะฐั€ะฐะปะดั‹ 13 ะœะ›ะ