These 8 minutes solved hours' of my headache. Very well explained
@charan_753 жыл бұрын
For me, days of headache.
@N7__78 ай бұрын
😂
@TheDataMaestro4 жыл бұрын
What makes this video awesome is: clear explanation of SQL feature, best practices of SQL, and alternative solutions. Those 3 are missing from many online courses.
@clovvnnor711310 ай бұрын
I was struggling with the logic of "WHERE dep = E. dep" part for almost a week, and ur small example is just so crispy and clear, I LOVE u man
@Sunny-wq9ue3 ай бұрын
I still don't quite get that part? Could you explain please?
@adityabhatt4173 Жыл бұрын
Sharing the Code for the same- /* Understainding a correlated subquery and a common use case To find out employees who have salaries greater then the avg sal of their dept */ DROP TABLE IF EXISTS COLLEGE; CREATE TABLE COLLEGE ( ROLL_ID INT , NAME VARCHAR(20), SALARY INT, DEPT VARCHAR(20) ) INSERT INTO COLLEGE VALUES(1,'Aditya',2000,'CSE'); INSERT INTO COLLEGE VALUES(2,'Aman',3000,'EC'); INSERT INTO COLLEGE VALUES(3,'Arun',3000,'CSE'); INSERT INTO COLLEGE VALUES(4,'Amit',4000,'EC'); SELECT roll_id, NAME FROM COLLEGE O WHERE SALARY > (SELECT AVG(SALARY) FROM COLLEGE WHERE DEPT=O.DEPT GROUP BY DEPT);
@telephonerock11 ай бұрын
Best explanation for correlated queries on KZbin.
@oqant04242 жыл бұрын
Great, thank you! Much easier to understand for those of us that need to visualize how it works. Spent the last 24 hours trying to understand this. Sincere thanks to you for this great explanation.
@akhdanarif94162 жыл бұрын
8 minutes of cure to people's headache all over the world. Best potion ever.
@pablo_brianese4 жыл бұрын
The most important part of the video is, in my opinion, the comparison with views and joins. It shows us why we would want to use correlated subqueries.
@kareemadesola65222 жыл бұрын
Could you tell me the graphics tool you used for this tutorial? Would really much appreciate it
@prinonmahdi10472 жыл бұрын
Spent the last 24 hours trying to understand this. Sincere thanks to you for this great explanation.
@chaos85142 жыл бұрын
how does it group does it group each time outer query runs?
@daniellestellrecht41057 жыл бұрын
Great, thank you! Much easier to understand than the Microsoft online course, for those of us that need to visualize how it works.
@dssingh99553 жыл бұрын
Hey, can you help me in some complex sub query??
@rajsekhardutta88913 жыл бұрын
Finally found a video that explains the topic in clear concise manner. Great explanation. Thanks!
@MySqueezingArm Жыл бұрын
Hey man, thank you for explaining something that I wasn't wrapping my head around. I thought it was a weird loop, but I realize it's just doing multiple comparisons (duh). Thank you so much.
@ranjithparuchuri64632 жыл бұрын
shall we write a query as select * from emp where sal>( select avg(sal) from emp group by deptno) with out using corelated sub query ??
@diegomartins58462 жыл бұрын
I would have solve it like that 👍
@Manoj_M_S6 жыл бұрын
Better than so many websites and videos explaining corelated query.. Nandri
@rishi45 жыл бұрын
Thanks a ton I was having so much trouble wrapping my head around this, u really helped me out, but I have a question, it looks like this is modeled similar to a Join, when it comes to Joins If I understand correctly there are essentially 2 ways to do it, 1) using the where clause (which causes problems for full joins) 2) using a Join clause and an ON clause (which I think is the reccomended method) is there any way to use the On clause instead of a Where in a Co-related subqueiry or does it not matter in this case?
@muhammadsafiullah84285 жыл бұрын
Emp as E doesn't mean that we are treating that specific RECORD/TUPLE as E. But it means that we are treating the table Emp as E.
@sindhujasekar40185 жыл бұрын
E is known as alias name for the table that means the temporary name for the table
@Robay1463 жыл бұрын
Wow, thank you so much! You have a gift for teaching! 🙏🏾
@elifgurel12626 жыл бұрын
do you not have to group by the department first and take the avg?
@harshpandey85595 жыл бұрын
No, since he's essential using a where clause. After the department filter, your avg(salary) essentially only grabs average for that specific department.
@TheDataMaestro4 жыл бұрын
@@harshpandey8559 correct, and he explains that depending on size of table, this solution could use additional system resources. Using GROUP BY is an alternate solution.
@sknrendra3 жыл бұрын
your explanations are so easy to understand! greetings from Indonesia.
@radosawlament67943 жыл бұрын
let me tell you my friend, all the comments are accurate, these 8 minutes saved me hours of analysis
@prithwishsen62935 жыл бұрын
Aggregate function cannot be used with where clause... So how come the inner query contains both togethee
@Cool94_4u5 жыл бұрын
bro where can be used with AGGREGATE func, the thing is you need to apply it on column which is not used on AGGREGATE func, ex. SELECT count(id) FROM test WHERE product_id10 HAVING count(id) >5
@habzy19876 жыл бұрын
very very helpful explanation. your content and tone of voice and pace is excellent. :)
@kathielizabeth47902 жыл бұрын
Good morning sir, where we will use this and only we will use in salaries...?
@lalit-singh-bisht Жыл бұрын
can you explain if we want to find the 3rd highest salary employee using nested query>???
@Shreymusic054 жыл бұрын
How can we compare single value (Sal) with multiple values? Will it not cause error?
@urinamilovic27646 жыл бұрын
Your explanation is great!! Thank you so much!
@RonaldJon126 жыл бұрын
Is the inner query executed just once or is it executed for every row returned by the outer?
@drew10356 жыл бұрын
Watch the video again. This is one of the first things he explains..
@tejuspn24063 жыл бұрын
Very well explained! Loved it! Thank you!
@kobayashi8190 Жыл бұрын
it is like iterate over rows in outer query (calling WHERE with column argument would iterate over rows) and copy the column value to the inner query (e.eid would evaluate to current row's eid value) sound like A nested loops in disguise...
@sagaromer8385 Жыл бұрын
why don't we use group by for average salary?
@adilismail35934 жыл бұрын
What if i dont use E and directly use Emp. Dep
@danee593 Жыл бұрын
What a great explanation!
@TheMaverickanupam4 жыл бұрын
Why can't we use group by dept in the subquery rather than referencing the outer query???????
@vikassharma26655 жыл бұрын
The above example is taken from Stack Overflow but I like the way you explained :)
@sreepaljsp4 жыл бұрын
may be, stack over flow got the content from this video.. or even if it is from stack over flow, he explained it very well..
@suryadevararama20563 жыл бұрын
can the question that is solved in this video using corelated query be solved using JOIN?
@SarahFeng92 Жыл бұрын
this was extremely helpful. thank you!
@OmPrakash-ot3nr3 жыл бұрын
Can the explained question be done with the help with joins? If yes, can someone please share the query.
@muhammadahsanbutt24914 жыл бұрын
If u Come up with SQL Microsoft by solving it practically with Table Form It will be more efficient :)
@hoannguyen22193 жыл бұрын
so touching for an excellent video
@pengxiaohan33714 жыл бұрын
Really good, sir! Clearly understood!
@kurakularajesh34607 жыл бұрын
In Agregate function of avg() ,where class cant be used in aggregate function it will get error sir.
@mallikarjun50005 жыл бұрын
we can use
@kalashnikov20311 ай бұрын
Clear explanation ❤
@muhammadzakiahmad80692 жыл бұрын
Thankyou very well explained.
@subhasreegupta39374 жыл бұрын
Really good explanation
@jullienb20554 жыл бұрын
Thanks bro, great video keep the good stuff
@jasminesultanah32706 жыл бұрын
can you have subqueries within your inner query?
@peoples_channel6 жыл бұрын
Jasmine Sultanah yes you can have...
@user-sj9xq6hb9p3 жыл бұрын
Very well explained
@excessreactant90453 жыл бұрын
This made me happy, thanks :)
@BHAWANISINGH-gi6jw4 жыл бұрын
Sir please upload video for class 11 ip mysql .it's a humble request
@abbloos8 жыл бұрын
Thank you so much!! I didn't understand this part but now I do
@caniceokoro77418 жыл бұрын
Very helpful, thank you.
@pranjalgrover54475 жыл бұрын
Well explained! Thank you!
@pantadeusz2933 жыл бұрын
Thank you very much!
@SelmaPreferParisАй бұрын
very helpful!
@phantrunghoaiminh7 жыл бұрын
Great explanation! Thanks a lot! :)
@rajdeepdey70936 жыл бұрын
very helpful....thank you very much
@plekkchand6 жыл бұрын
Very helpful. What language is being spoken?
@guilhermedealmeidacosta66446 жыл бұрын
Thank you for the video.
@SpaceNStuff7 жыл бұрын
Helped me a lot, thnx
@navaneesubburaj30866 жыл бұрын
nice tutorial thank you so much
@veenasgoodtimes27816 жыл бұрын
thank you so much......i was so helpless.......
@jenspeter4377 жыл бұрын
thank you my friend
@deemaalabdulaali31478 жыл бұрын
thank you so much
@Martin-zm8gq6 жыл бұрын
Curry inside a curry?
@bquimby52232 жыл бұрын
Bro. Thank you.
@Lumary7 жыл бұрын
Thanks a lot! :)
@aleksandar53236 жыл бұрын
Thank you!
@moutazka873 жыл бұрын
Thank you
@suziewilliams21465 ай бұрын
Perfect!
@2002S404 жыл бұрын
IN subquery is one of worst practice to In SQL. Should've use join.