Subquery in SQL | Correlated Subquery + Complete SQL Subqueries Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ม.ค. 2025

ความคิดเห็น • 1.3K

  • @inderpanda
    @inderpanda ปีที่แล้ว +21

    8:20 - Scaler subquery ( only fetches 1 row & 1 column
    11:55 - Multiple Row subquery
    type 1 - multiple row, multiple column
    18:30 - type 2 - multiple row, single column
    22:18 - Co-related subqueries
    37:29 - Nested subquery
    46:33 - Different Clause where subquery is allowed. ( select, from, where, having )
    56:30 - SQL commands that allow subquery ( insert, update, delete )

  • @lasu5060
    @lasu5060 2 ปีที่แล้ว +40

    Since I started my new job I've been running away from subqueries. Whenever the query reached a certain level of complexity I referred it to the data scientist, this week I faced a challenge in which I will not be able to escape from the subqueries. I watched several videos and none reached this level of detail, mainly explanation. It will help me a lot. Thank you!!! Eternally grateful.

  • @Anonymous_it_is
    @Anonymous_it_is 2 ปีที่แล้ว +111

    I haven't seen explanation of this kind anywhere, even paid courses fail to teach this way. Kudos to you man! I can't thank you enough. Magnificent content!!!
    SQL learners need a teacher like you.

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +7

      Thank you Rohit. glad you liked it :)

    • @chaitalibanerjee5459
      @chaitalibanerjee5459 2 ปีที่แล้ว +1

      True

    • @rooja1000
      @rooja1000 2 ปีที่แล้ว +1

      @@techTFQ u r such a true teacher.. who explains so clearly..n all concepts r actually easily understandable..learning so much from ur knowledge n way of teaching n explaining..thanks a lot...

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Thanks a lot Rooja 🙏🏼

  • @atharvapathak3411
    @atharvapathak3411 2 ปีที่แล้ว +104

    Man you are the most humble teacher i ever saw,
    1) You make hard things look easy
    2) You know exactly where people will have doubts and the pain of those ( Not only you revive that with solutions but also give precautions )
    3) You explain things again and again without any hesitation or showing an attitude which i love the most! Everyone can see how much you want to make things understandable and easy for all.
    I'm really looking forward for a ' Whole Advance SQL statements using Windows function and their applications' Video
    Using Timestamps, extract, rank in those cases is quite tricky and I'm sure you are an Aid to those!
    KUDOS To You With All The Respect!
    Keep doing the work you do, no one else is at this level and Humbleness 🤜🏻

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +19

      Hi Atharva ,
      It’s really pleasing to read such feedback. Thank you very very much for your kind words.. truly appreciate it and I am so happy to know you find value in my contents 🙏🏼🙏🏼🙏🏼☺️

  • @yogamayaa
    @yogamayaa 2 ปีที่แล้ว +451

    Can we all take a moment to appreciate this guy, providing such amazing content for free? Hats off to you Sir. These videos are extremely useful for students like me :)

  • @MrBrunoPING
    @MrBrunoPING 3 ปีที่แล้ว +558

    It's impossible to have a better video than this one about subqueries, here on TH-cam. I challenge someone to present me something at this level, of didactics, examples and duration. THANK YOU TEACHER! WILL FOLLOW YOU IN ALL YOUR VIDEOS!

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +56

      Thank you for the amazing feedback bro.
      I am so glad you found this helpful :)

    • @emrannoon2179
      @emrannoon2179 2 ปีที่แล้ว +9

      I 101% agreed Bruno. I love the way he explained

    • @emrannoon2179
      @emrannoon2179 2 ปีที่แล้ว +7

      @@techTFQ You are rocking bro

    • @veerabhadrarao258
      @veerabhadrarao258 2 ปีที่แล้ว +2

      Awesome

    • @enshk79
      @enshk79 2 ปีที่แล้ว +2

      You said didactics!!!!! Awesome.
      And I concur!!!

  • @minithyagraj6692
    @minithyagraj6692 7 หลายเดือนก่อน +7

    For a first-timer in coding, I can say that I have understood how coding works and its all because of your brilliant way of not just explaining the queries but also explaining how SQL processes the code, which is truly amazing. Thank you and God bless!!

  • @sudarshanmhaisdhune1039
    @sudarshanmhaisdhune1039 ปีที่แล้ว +5

    The BEST video on subqueries on this platform. What a stuff this man have put in here. Legend!

  • @visceralcinema
    @visceralcinema 11 หลายเดือนก่อน +3

    I think what's most effective about your tutorials is you don't just execute simple sql statements to illustrate a point, you actually provide real problems and demonstrate your "approach" with solving them--they're almost like "word problems" from primary school. 🤭 This has helped me understand greatly how to breakdown (future) problems.

  • @gokulnath4297
    @gokulnath4297 2 ปีที่แล้ว +10

    One of the finest tutor I have ever seen, Going with the pace where the every concept is covered within a short time.

  • @vedanthasm2659
    @vedanthasm2659 3 ปีที่แล้ว +46

    You are one of the best SQL tutor👍 I have seen. The best part is, you take one topic and cover everything in that (Full meals 😁). No need search any other content. Super helpful... Bro!

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +7

      Thank you Vedantha for this amazing feedback :)
      Really motivates me to make more :)

  • @bakhtavarhafeez702
    @bakhtavarhafeez702 2 ปีที่แล้ว +4

    The best subquery video I’ve come across on TH-cam. Simple and easy to comprehend.

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว

      Thank you Hafeez. glad you liked it :)

  • @mahdi-saber
    @mahdi-saber 2 ปีที่แล้ว +14

    I have always used ORM tools to generate SQL queries, since I was afraid about complex queries. After watching your video three times, I feel quite confident to go deeper and write down complex native SQL commands. I wish you the best for such a thoughtful content!

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Thank you Mahdi :)

  • @PrasanthKumar-pw9bk
    @PrasanthKumar-pw9bk 8 หลายเดือนก่อน +1

    Stopped Surfing in internet about SQL and simply following your videos now. Its such a clear content that you deliver for us free. Thank you Sir!

  • @victor_peral
    @victor_peral ปีที่แล้ว +5

    The simplicity with which you broke down complex topics is a sheer gift
    Keep it up

  • @أبويزيد-ض5ي
    @أبويزيد-ض5ي 2 ปีที่แล้ว +7

    40:20
    I believe you have made a mistake solving this question.
    The total sales is not just adding up the price column, but we must multiply the price column and the quantity column to calculate how much each store made as total sales. In other words, (Quantity * Price = Total Sales).
    Here is my code:
    select store_name, sum(quantity*price) as total_sales from sales
    group by store_name
    having total_sales > avg(quantity*price);
    Here is the longer version:
    select * from (select store_name, sum(quantity*price) as total_sales from sales
    group by store_name) as a
    join (select avg(quantity*price) as avg_sales from sales) as b
    on a.total_sales > b.avg_sales
    Thanks

    • @AbhishekChoudharyB
      @AbhishekChoudharyB 4 หลายเดือนก่อน +3

      I had the same doubt.
      I was wondering why no one pointed that out.

    • @أبويزيد-ض5ي
      @أبويزيد-ض5ي 4 หลายเดือนก่อน +1

      @@AbhishekChoudharyB
      If you started studying now aiming to get a job, change your plans. I have been looking for a job as a Data Analyst since two years and never landed a job yet. I live in the US.

    • @02artiom
      @02artiom 3 หลายเดือนก่อน

      @@أبويزيد-ض5ي That is sad to hear brother... What kind of certificates do you have on your resume? do you have a portfolio? Btw your arab name flipped my text LOL

    • @أبويزيد-ض5ي
      @أبويزيد-ض5ي 3 หลายเดือนก่อน

      @@02artiom
      I have a portfolio website that has some nice projects on it.
      I have a Bachelor’s Degree in Statistics
      I have IBM Professional Data Analyst Certificate.
      I have some certifications in SQL and Excel.
      If you are starting now, I advise you to run away and pick a different career because things are getting even worse.
      If you are still a student, pick a medical career because you will always find a job in healthcare.

    • @yashiktaneja673
      @yashiktaneja673 2 หลายเดือนก่อน +1

      ​@@AbhishekChoudharyBif you see the values of quantity and price carefully u would observe the price given is not the individual product price but price of the quantity of product sold

  • @itsnature5391
    @itsnature5391 ปีที่แล้ว

    hey man only person on youtube to teach sql so simplistically

    • @techTFQ
      @techTFQ  ปีที่แล้ว

      Thanks buddy , glad it helps

  • @sachinsuman8536
    @sachinsuman8536 ปีที่แล้ว +4

    Hi. Your videos are great. Thanks for the effort you are making just for us to learn. I really appreciate that. While solving the UPDATE related question, I think the answer should be this:
    update employee e
    set salary=(select max(eh.salary) * 0.1 + e.salary
    from employee_history eh
    where e.dept_name=eh.dept_name)
    where e.dept_name in (select dept_name from department where location='Bangalore')
    and emp_id in (select emp_id from employee_history);

  • @suigeneris1242
    @suigeneris1242 หลายเดือนก่อน +1

    This is an awesome tutorial. Initially, I thought the examples were going to be redundant, but you cleared my doubts by covering the diverse uses of subqueries. Thanks for this video!

  • @shilpikundu6279
    @shilpikundu6279 ปีที่แล้ว +6

    Never come across a better SQL teacher like you, every point sooo detailed! This is like a goldmine for SQL. Kudos to you for curating such awesome content!!!

  • @yashrajsingh9961
    @yashrajsingh9961 9 หลายเดือนก่อน +1

    This video was amazing, i really thing the free code camp audience would go nuts for this video, if you ever thing about donating this series

  • @jayeetadas6735
    @jayeetadas6735 3 ปีที่แล้ว +4

    Bhaiya, your videos are just awesome. I was not good in sql. But I have started clearing interviews. Explanation is very nice and clear. Keep it up. Now step by step I will try to do it. Windows function video was really helpful. My concept is clear now.

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      Thank you Jayeeta for your kind words :)
      Really happy to know my videos have helped 🙏

  • @ashutoshpandey1452
    @ashutoshpandey1452 2 ปีที่แล้ว

    I had learnt sql from various sources...but no one can match up the with your tutorial. And I prepared for the job by watching your tutorial and successfully got the job.

  • @ItsWithinYou
    @ItsWithinYou 3 ปีที่แล้ว +4

    Superb! Thank YOU Taufiq for sharing this video. I could not find a better explanation of correlated subquery anywhere else. Now, I am very clear about this topic. I appreciate all your help!

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      I am glad to hear that Rajiv :)

  • @shaziasulthana9454
    @shaziasulthana9454 ปีที่แล้ว +1

    super explanation haven't seen explanation of this kind anywhere, even paid courses fail to teach this way. Kudos to you man! I can't thank you enough. Magnificent content!!! Brilliant tutor thank you
    SQL learners need a teacher like you.

  • @W3Fi
    @W3Fi ปีที่แล้ว +9

    Sir, could you please make a video on elucidating when to use Join over Sub queries or vice-versa? Indeed, this is one of the major drawback for the beginner like me to deal with it in the initial stage.

  • @IoT_
    @IoT_ 24 วันที่ผ่านมา

    Subscribed! I have watched tons videos on subqueries, that one made almost 100 percent clear this concept. I said "almost" just because I am not smart enough to make to the full comprehension

  • @mohammedshahil4898
    @mohammedshahil4898 3 ปีที่แล้ว +17

    A much needed one. Subqueries are the ones which i encounter the most in my work. And this video really helped me understand it even more clearly. Thank you so much Brother for yet another helpful video🙏🏻🙌🏻 👏🏻

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +2

      I am glad you liked it bro 😍
      Thank you ☺️

    • @eealliance5997
      @eealliance5997 2 ปีที่แล้ว

      Please what kind of work? I hardly find jobs where you have to make constant queries to a database.

  • @RajashreeBirajdar-n8v
    @RajashreeBirajdar-n8v 3 หลายเดือนก่อน

    I haven't seen explanation of this kind anywhere, even paid courses fail to teach this way. such a great! really thank you so much i have cleard my all doubts

  • @laurak5196
    @laurak5196 3 ปีที่แล้ว +5

    Yes!! So glad you covered this in such a detailed video. Can’t wait to watch! Thank you so much!

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      Your welcome Laura 🙏🏼
      Do give me your honest feedback after you watch the video..

    • @laurak5196
      @laurak5196 3 ปีที่แล้ว +1

      @@techTFQ I enjoyed it! I do have some thoughts tho but it will take me time to compile those and send. It was a crazy day. I think subqueries are the hardest thing left for me in SQL except that I need to get more practice with window functions and also the with clause. But for subqueries I always feel like there is so much more to them. This video is helpful but I’d like to see a more general one to explain the various use cases for the placement of subqueries in the various clauses. Your real world experience such as when you mention that this is something we do all the time or this is something that is really not recommended to do and then you explain why - those comments are very helpful bc I’ve never been in this field and you are a pro so those pro tips are so valuable. So the use cases for the different placements in select, from, and where and also the performance for those for me would be also useful to have a solid understanding of. You did explain use case and performance in some detail for correlated subqueries in this one which was very useful, but I personally would like to have a better understanding of when the subquery in the from vs select vs where clause is the best choice vs forgetting the subquery altogether and going with the with clause. So, in the real world how often do you use subqueries vs the with clause and best use cases for each. Maybe a video to encompass all of that. And I think that making it very clear that any subquery in the from clause must have an alias is something that beginners don’t necessarily always know so that could perhaps be emphasized. I love that you spent an hour explaining subqueries but I could see another video stepping back in more general terms being also very useful. I hope this was helpful. Thanks for all of your good work. I also like the new background. 😊

    • @laurak5196
      @laurak5196 3 ปีที่แล้ว +1

      @techTFQ I also want to add that I’m honored that you asked for feedback. I’m not sure if that was what you were looking for. I hope you have a nice night. 🙏🏻

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      Hi Laura, I loved this feedback. Kind of gave me an idea for a future video which should clear your doubts about where to use subquery and when to use it. And not just subquery but in general how to apply any SQL concepts when solving problem using SQL.
      But first let me thank you for this amazing feedback because I am sure this took you a very long time to compile and write them down. I completely understand your point of view and its something that a few others have asked me as well.
      But the thing is that, the only way you can clearly understand "where to use a subquery and when to use it and what concept of SQL to use and not use when solving a problem", all these will get clear only with experience. You need to solve many many queries, only then you will get an understanding of what to use when.
      But yes, I can frame some tips and tricks which can give you a better idea of what subqueries to use and where to use them and when to use them based on what kind of requirement.. Just that I can explain these by hopefully solving different types of SQL queries.
      Let me try to plan a video revolving this and come up with some tricks and tips.
      And thank you for noticing the new background 😀
      Bought a new camera and some lights and just starting to learn how to make better videos. Hopefully my video visuals and editing will get better with time.
      Have a great day Laura and Thanks again for your amazing suggestion 🙏

    • @laurak5196
      @laurak5196 3 ปีที่แล้ว +1

      @@techTFQ Thank You for taking the time to write such a detailed reply, Thoufiq. I’m so glad the TH-cam algorithm finally got some sense and started steering me to your channel. I’ve learned so much from you and I really appreciate your encouragement and guidance. It’s true what they say: You are the best SQL teacher on TH-cam. I can’t believe how your subscribers have grown since I found you at under 7K. This is a testament to your knowledge and experience and not only that but your way of explaining and your patience and clarity too, along with humility, which is rare and valuable as well. I hope and trust that all of your aspirations will become reality! And thank you again for your hard work. I’m so glad the feedback was helpful. I do so appreciate your feedback and tips for me too. Have a great night and hugs to your family 🙏🏻😀

  • @laurak5196
    @laurak5196 ปีที่แล้ว +1

    Wow, Thoufiq!! Look at you go, almost 200K! Well deserved, my friend, and so happy for your success!

    • @techTFQ
      @techTFQ  ปีที่แล้ว +1

      Thank you Laura ☺️☺️☺️
      Always special to read your well wishes 🙏🏼

  • @surbhidaksh1549
    @surbhidaksh1549 2 ปีที่แล้ว +3

    Best Teacher with best Teaching methods and explaining each n every topic.
    Amazing content 😊👍

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Thanks a ton Surbhi

  • @Euphoria-k6r
    @Euphoria-k6r ปีที่แล้ว

    Almighty has saved my time in exploring here and there for learning sql and landed your youtube channel directly.

  • @kaviyathamizharasan1451
    @kaviyathamizharasan1451 3 ปีที่แล้ว +9

    Splendid Video Thoufiq !! 👏👏Neat and clear explanation of all the concepts.
    Types of Queries you did framed to solve in this video is like a cherry on the cake.
    Many thanks for considering our request and working on the same.
    TechTFQ and Thoufiq will surely be my go-to channel/person for SQL hereafter.
    I wish you should be recognized and appreciated by many subscribers very soon. Please keep doing the great work 😊🙏

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +2

      Thank you so much Kaviya for your amazing feedback :)
      I truly appreciate you taking time to leave this feedback.
      I am so glad you liked the content and than you so very much for your kind wishes :)

    • @kaviyathamizharasan1451
      @kaviyathamizharasan1451 3 ปีที่แล้ว +1

      @@techTFQ Pleasure is all mine 😊🙏

  • @snehasn91
    @snehasn91 ปีที่แล้ว +1

    You are really good. I go through all your SQL videos whenever I need to go for interviews, and it always works for me. Here I am back again to watch your videos as I am in middle of a job search! Wish me luck. Thank you so much for these wonderful videos, they are the best!

    • @techTFQ
      @techTFQ  ปีที่แล้ว

      Thank you Sneha and wishing you all the best 👍

  • @cynthiazhu473
    @cynthiazhu473 2 ปีที่แล้ว +7

    Subqueries are so tricky to me but this is by far the most detailed and comprehensive explanation on subquery that I've seen! Thank you soooooo much for that. Quick question on the total sales example, shouldn't we use SUM(quantity * price) to get total sales instead of just SUM(price)?

    • @softwarekabaapno1
      @softwarekabaapno1 ปีที่แล้ว +3

      I'm guessing the price column represents total price and not price per unit.

  • @itikalaneelu9126
    @itikalaneelu9126 ปีที่แล้ว

    i have gone through hundreds of videos on Joins but unable to get the knowledge. With just one video i became expert in joins :) this is because of you sir . Keep up the good work. I will be following your videos going forward. excellent explaination without any confusion.

  • @sonu2op747
    @sonu2op747 10 หลายเดือนก่อน

    We can say that this is the most requested video by all subscribers and I took a course from a website but the way you explain this content is much better than any paid course I love your videos and the way to explain all this. Much appreciated sir.

  • @Pankaj_Menaria_Bawa
    @Pankaj_Menaria_Bawa 3 ปีที่แล้ว +5

    Most awaited video I was waiting for...thank you sir.. following you on LinkedIn ❤️

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      Thank you Pankaj 🙏🏼
      I hope you like this one

    • @Pankaj_Menaria_Bawa
      @Pankaj_Menaria_Bawa 3 ปีที่แล้ว +1

      @@techTFQ yes sir it helped me a lot ❣️

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      I am glad to hear that ☺️

  • @sourabhroy8731
    @sourabhroy8731 2 ปีที่แล้ว +2

    Man...what an explanation. I have attended paid courses for SQL but never understood the concepts so clearly. Thank you so much and i will be soon joing your 3 Aug batch.

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Glad you liked it 🙏🏼

  • @shaffumehta1405
    @shaffumehta1405 3 ปีที่แล้ว +4

    best content quality on this plateform ....amazing sir and god bless you sir and thanku so much for sharing your knowledge so deeply and nicely...it really helped a lot of students

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Thank you Shaffu 🙏🏼
      Glad you liked it

  • @kennedymatanda4972
    @kennedymatanda4972 2 ปีที่แล้ว +1

    I can download this video a thousand times just because of the quality of the presentation!. Good work bro.

  • @yomtovaharoni
    @yomtovaharoni 2 ปีที่แล้ว +8

    well detailed and great explanation of an important topic in SQL!
    I think there might be a mistake in the question with the number of units sold by each store.
    the average is (3+2+11+6)/4 and is far greater from 2 which you remarked :)

    • @MalayKhandkar
      @MalayKhandkar 2 ปีที่แล้ว +2

      well noted! even i made that observation

    • @hnull99
      @hnull99 ปีที่แล้ว +3

      Yes, I dont know why he made this mistake because in the avg(prive) exercise he said that you have to group them and then calculate the avg().

    • @youssefa7172
      @youssefa7172 ปีที่แล้ว

      @@hnull99 in that example he said across all stores

    • @BabalolaMalik-jd5ut
      @BabalolaMalik-jd5ut ปีที่แล้ว

      I also observe that as well 👍
      I think that's a mistake
      We should be left with 2 stores

    • @surajtiwari9078
      @surajtiwari9078 ปีที่แล้ว

      Yes ! As the avg price for all stores coming as 2200.0

  • @paulchukwuka6653
    @paulchukwuka6653 ปีที่แล้ว +1

    You are just the best, just know that i am learning alot from you. Much respect from NIGERIA

  • @aurojitmishra2542
    @aurojitmishra2542 2 ปีที่แล้ว +5

    Timestamp 55:30
    The average will be 5.5 (11+2+6+3/4) .
    But the query resulted as 2.2.
    Any thoughts?

    • @aryar7510
      @aryar7510 2 ปีที่แล้ว +2

      Even I have the same thoughts

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +2

      It is 2.2 because it is the avg of quantity from the entire sales table..
      You avg of 5.5 is the avg when considering the group by query ..
      Difficult to explain in comment but if you read the query statement properly and try it out yourself, you will come to know

    • @aurojitmishra2542
      @aurojitmishra2542 2 ปีที่แล้ว +1

      Thanks for the explanation 🙌

    • @paulhowrang
      @paulhowrang 2 ปีที่แล้ว +4

      @@techTFQ True but it defies logic, if we have multiple entries of the same store, you cant take average without summing from individual stores, moreover, this cant be just ignored because it is for learning purpose, the query will become more involved, to a more attentive student current case seems confusing

    • @yoo0angg
      @yoo0angg 2 ปีที่แล้ว +2

      I noticed this right away as well. I am very much an SQL newbie but the average of 2.2 is taking the full sales table into account with multiple store rows and not aggregating the total sales for each store. It is incorrect. You have to take the average using the group by clause.

  • @hiulaicheng3781
    @hiulaicheng3781 ปีที่แล้ว

    This is the best SQL video I have ever seen. Thx

  • @satheeshkumarak6708
    @satheeshkumarak6708 2 ปีที่แล้ว +3

    @ 1:06:06 , in line number 164, I think it should set salary = (select salary + (max(salary*0.1))
    Each Employee's salary should be incremented from his own salary and not from the maximum salary. The maximum salary is to be considered only for calculation of the increment.
    Am I right?

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว

      Nope.. the question was to provide increment based on the max salary not considering each employee salary

    • @satheeshkumarak6708
      @satheeshkumarak6708 2 ปีที่แล้ว +1

      @@techTFQ , so based on your logic, Sir, everyone from a department will be having equal salary, right?

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Exactly

  • @satishkumar-lh6kz
    @satishkumar-lh6kz 2 ปีที่แล้ว +1

    your teaching is much better than many celebrity trainers, great teaching, thank you for wonderful explanation

  • @velap2129
    @velap2129 3 ปีที่แล้ว +3

    Saving this to my folder and I am sure I m going to watch this multiple times... Going to be very useful... Thanks
    Btw, could you have a video explaining how to analyze the performance of different queries that accomplish same result but performance is different due to the way it is handled

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      Thank you Vela :) I hope you like it.
      As for performance of different queries, ill make separate video about it.

    • @velap2129
      @velap2129 3 ปีที่แล้ว +1

      @@techTFQ certainly, like all the videos you make. It really shows how much efforts you put into it to make it very clear to everyone. I'm in no way connected to sqls at work, but got interested at after seeing your videos.

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      Amazing vela , I am so glad to read this ..
      Thank you 🙏🏼

  • @SambitKuSahu
    @SambitKuSahu 3 ปีที่แล้ว +5

    Thank you so much for your valuable info on subquery.

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Your welcome Sambit 🙏🏼

  • @pspointssara8472
    @pspointssara8472 ปีที่แล้ว

    for the UPDATE sql at 1:07:00, you have shown: SET salary = (select MAX(salary) + MAX(salary) * 0.1). This should be 'SET salary = salary + (select MAX(salary) * 0.1' .....). Otherwise, each employee will get a MAX salary in their department + 10% which may not be correct and all the employees will get the same salary+10% in their department. Please correct me if I'm wrong. Great video, thanks.

  • @shivsharma9153
    @shivsharma9153 3 ปีที่แล้ว +4

    This is an amazing video..thank you for helping students like me!!!!!!!!!❤❤❤❤❤❤❤❤

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      I am so glad to hear that Shiv ..
      Thanks for your feedback and I am glad this helped ☺️🙏🏼

  • @KetakiGadgil_15
    @KetakiGadgil_15 2 หลายเดือนก่อน

    Hi, thanks for the informative video.
    At 28:11, alternate solution is
    select * from employee emp
    join (select dept_id,avg(salary)
    as avg_sal from employee
    group by dept_id) avg_sal
    on emp.dept_id = avg_sal.dept_id and emp.salary > avg_sal.avg_sal

  • @shohelkasamji11
    @shohelkasamji11 2 ปีที่แล้ว +3

    Your explanation is amazing, really love watching your videos as I get to learn so much and they’re not boring either. Thank you so much for sharing this. Keep up the amazing work. 👊🏽👍🏽

  • @mango-strawberry
    @mango-strawberry หลายเดือนก่อน

    scalar subquery
    multiple row subquery
    correlated subquery
    37:49 Nested Subquery
    46:24 with clause
    46:38 different clauses in SQL where subquery is used
    select
    from
    where
    having
    50:50 subquery inside select clause
    avoid using subquery with SELECT clause
    56:32 sql commands which allow subquery
    INSERT
    UPDATE 1:03:30
    DELETE 1:08:29

  • @pam9367
    @pam9367 3 ปีที่แล้ว +3

    Thalaiva u r great... learned more thanks 🤞🙌

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      haha Thank you buddy 😍

  • @abhigoswami6668
    @abhigoswami6668 2 ปีที่แล้ว +2

    where were you my angel? I have attended multiple trainings for SQL but nobody explains the concept in the way you do!! Quality content with practical examples. Hats off to you for helping so many IT professionals to understand SQL in depth.

    • @rainbow100_
      @rainbow100_ 2 ปีที่แล้ว

      Wanna ask what system management did he use in this video and what do use ?

    • @ndz7372
      @ndz7372 ปีที่แล้ว

      @@rainbow100_ Pg admin on postgres

  • @saurabhrajput7482
    @saurabhrajput7482 3 ปีที่แล้ว +4

    Sir, please provide us with the same table are you using during the written query.
    Thanks for uploading this amazing video.

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Yeah I’ll share all these scripts in my discord server .. so you can join my discord using the link in video description

    • @saurabhrajput7482
      @saurabhrajput7482 3 ปีที่แล้ว +1

      Ok Thanks again 👏

    • @kamalbashir786
      @kamalbashir786 3 ปีที่แล้ว +1

      @@techTFQ Sir,when you share the script on Discord server. as I just checked I didn't found out script there

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      It’s there in announcement channel..
      U can ask other in discord if u can’t find it

  • @rajeshjadhav2761
    @rajeshjadhav2761 2 ปีที่แล้ว +2

    Best SQL video i have been through...The Way making us to understand and the language used can help even non tech guys like me to understand easily...Thank you so much... keep doing....

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว

      Glad you liked it Rajesh

  • @Zenith40450
    @Zenith40450 3 ปีที่แล้ว +3

    Nice explanation...Helpful content...👍👍👍

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Thank you Ambar 🙏🏼

  • @dharaneeswaran4086
    @dharaneeswaran4086 5 หลายเดือนก่อน

    I have attended many interviews confusion with this subquery and types and you just nail it...on the money. Thank you so much!!

  • @urvindarkaur0278
    @urvindarkaur0278 2 ปีที่แล้ว +4

    Hi , what an amazing effort!! THNAKS A MILLION!! Totally worth it. Also, kindly share the content notes if you have created for these stuff as it will be easy to practise alongside

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Thank you :)
      I have shared the dataset and all the scripts in my discord. link to join my discord is in video description

  • @itikalaneelu9126
    @itikalaneelu9126 ปีที่แล้ว

    This video is far far better than any videos in entire youtube

  • @harithaatla8937
    @harithaatla8937 3 ปีที่แล้ว +3

    thank you so much for clear explanation

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Your welcome Haritha 🙏🏼
      Glad you liked it

  • @readistreet9383
    @readistreet9383 3 ปีที่แล้ว +3

    thanks a lot for the videos, you explain it very well!

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Glad you like them bro!

  • @Anilkumar-reddy
    @Anilkumar-reddy ปีที่แล้ว

    Take a bow to these guy for him amazing work. Thank You Toufiq for all your videos. Please continue your work. will always support you

  • @AsadAli-wi1xs
    @AsadAli-wi1xs 3 ปีที่แล้ว +7

    Sir please make the video on sql store procedure and trigger...

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +2

      Sure bro will do it

  • @damodardy5761
    @damodardy5761 2 ปีที่แล้ว +2

    IT IS ONE OF THE BEST VIDEOS ABOUT SUBQUERY. THE EXPLANATION WAS CRISP AND CLEAR. THANKS FOR ALL YOUR EFFORTS

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Thank you Damodar.. glad you liked it

  • @mangeshputran6593
    @mangeshputran6593 3 ปีที่แล้ว +3

    Thank you for the amazing content.

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Your welcome bro. glad you liked it

  • @tamilarasic1159
    @tamilarasic1159 5 หลายเดือนก่อน

    you are a GEM. I never find a place to learn all these variations of sub query. Much useful video. Thank you so much for this wonderful lecture.

  • @fathimafarahna2633
    @fathimafarahna2633 3 ปีที่แล้ว +3

    Amazing 👏

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Thank you 😍

  • @luckykumar1665
    @luckykumar1665 2 ปีที่แล้ว +2

    At 54:21, if we calculate the average unit sold by 4 departments = (11+2+6+3)/4 = 5.5,
    just confused by the result we are getting from the query at 54:55
    select avg(quantity) from sales; here we got 2 as avg.......
    can we use this one if not then please explain? I am confused.
    select avg(avg_count.quantity)
    from (select store_name, sum(quantity) as quantity from sales group by store_name) as avg_count

  • @kushagrasharma5944
    @kushagrasharma5944 3 ปีที่แล้ว +4

    Please can you share the dataset

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +1

      I have shared the dataset in my discord channel.
      you can join my discord using the link present in video description

  • @Vishnu-Kanth-01
    @Vishnu-Kanth-01 3 หลายเดือนก่อน

    The best video on subquery till date. But the clip from 57:14 is 🔥👌. Wonderful explanation.

  • @nisha6165
    @nisha6165 3 ปีที่แล้ว +4

    You are a great teacher 🎉 wonderful method of teaching 😀 pls try to be Active on this platform because a teacher like u is need for everyone..
    If u know sql data tools kindly post it when u r free..
    Thanks for the great work♥️
    Because free education is the world's best education 🎈

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Thank you Nisha ☺️🙏🏼
      I am glad you value my contents so much .. and yeah I want to post more video on TH-cam.. working towards it..
      May I know what u mean by data tools?

    • @nisha6165
      @nisha6165 3 ปีที่แล้ว +2

      @@techTFQ Data tools like SQL SERVER INTEGRATION SERVICES (SSIS), ANALYSIS SERVICES(SSAS),REPORTING SERVICES (SSRS).
      Thanks for your reply 🎈

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว +2

      Oh ok got it..
      Noted and let me consider the suggestion

    • @nisha6165
      @nisha6165 3 ปีที่แล้ว +1

      @@techTFQ Thanks 😊

  • @pravinsonawane5799
    @pravinsonawane5799 5 หลายเดือนก่อน

    "Fantastic explanation! Your teaching style made the concept of subqueries so much clearer. I really appreciate the time and effort you put into breaking down the material. Thanks for another insightful and helpful video!"

  • @puttaezra
    @puttaezra 2 ปีที่แล้ว +3

    CAN I KNOW THE REASON WHY U HAVE DELETED PLAYLIST ?

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      What’s wrong with you man.. who said I deleted playlist?
      I have renamed the playlist hence may be the old link with old playlist name does not work.. just go to the channel and see all playlist there..
      At least think twice before posting such comments

    • @puttaezra
      @puttaezra 2 ปีที่แล้ว

      @@techTFQ SORRY BROTHER , COULD YOU OFFER YOUR COURSE FOR FREE , BECAUSE I AM VERY ENTHUSIASTIC TO LEARN SQL, PYTHON .RIGHT NOW I AM A STUDENT , COULD YOU HELP ME BROTHER. RIGHT I AM STRUGGLING WITHOUT JOB.

    • @ansu0406
      @ansu0406 22 วันที่ผ่านมา

      Thanks alot for ur contribution​@@techTFQ

  • @shivambajpai5919
    @shivambajpai5919 ปีที่แล้ว

    super video on SQL subqueries . A complete take on subqueries with practical examples. Definitely the Best Video on whole youtube even better than paid classes .

  • @rojalibiswal8975
    @rojalibiswal8975 3 หลายเดือนก่อน +3

    Dataset please

  • @truptipatil6962
    @truptipatil6962 7 หลายเดือนก่อน

    HI techTFQ ,You made SQL easier to understand ,I am following you for SQL ,And I understood very well .Thank you 😃

  • @harichandrajaiswal8804
    @harichandrajaiswal8804 2 ปีที่แล้ว +1

    It's impossible to have a better video than this one about subqueries u are the best sirr

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว

      Thank you :)
      Glad this helped

  • @rajeshmajumdar4999
    @rajeshmajumdar4999 3 หลายเดือนก่อน

    You are really excellent at making complex things so easy. I really liked the way you take part-by-part queries and combine them. I subscribed to you, sir.

  • @jatinyadav8960
    @jatinyadav8960 2 ปีที่แล้ว +1

    Best video on practical Implementation of Sub Queries on TH-cam

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว +1

      Thank you Jatin

  • @aniketsonmali6672
    @aniketsonmali6672 10 หลายเดือนก่อน

    THE BEST SQL TUTORIAL AVAILABLE ON YT 💯💯💯

  • @supersql8406
    @supersql8406 ปีที่แล้ว

    Fantastic! This video even helps professionals SQL writer like me who needs a quick refresher!

  • @glstnlev
    @glstnlev 3 ปีที่แล้ว +1

    You are the king. To me it’s the most difficult part of learning SQL. Thank you!

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Thank you Levon 🙏🏼
      Glad you liked it

  • @AnilKumar-ve2yl
    @AnilKumar-ve2yl 10 วันที่ผ่านมา

    best explanation i have ever seen , keep it up , it was very helpful to know that there are endless possibilities to solve a complex problem.

  • @tanimf1
    @tanimf1 4 หลายเดือนก่อน

    plz bro keep this playlist free in the future also.No other tutorial regarding sql comes near to your level.The way u have taught us is absolutely mesmerizing and crsytal clear also.Huge thanks .Keep shining bro ❤❤❤

  • @chandrikalakshmikandan8895
    @chandrikalakshmikandan8895 ปีที่แล้ว

    First of all thanks to explain in deeply in this concept.
    You make hard things to teach in easy way.
    Hats off to that.

  • @arunsingh768
    @arunsingh768 7 หลายเดือนก่อน

    U r really a good mentor on SQL. Very good concept. I have learnt to many things from ur vedio

  • @dominiktokarski8054
    @dominiktokarski8054 ปีที่แล้ว

    I'm just in 1/3 of this video but I need to smash like button right now because your video perfectly teach in easy way many concepts I thought were much harder to learn. Keep doing content like this brother.

  • @manithsuy286
    @manithsuy286 ปีที่แล้ว

    I've been having such a hard time with subqueries on how to write them, understanding them, etc. You've helped a lot thanks.

  • @lynchian275
    @lynchian275 8 วันที่ผ่านมา

    Wonderfully explained. God bless you, Thoufiq!

  • @DenverTrading
    @DenverTrading 6 หลายเดือนก่อน

    At 1:06:00 You set the salary = (select max(salary) + (max(salary) * 0.1)
    I read that each employee should get a 10% raise based on the employee with the highest salary.
    If I read this right, this code sets each salary to the highest employee's salary + 10% which is different that giving a 10% raise based on the highest salary which would be: salary = (select salary + (max(salary) * 0.1). Using the first line sets all employees to be making the same money as the highest employee + 10%.
    Please clarify.

  • @ekaterinazakimatova1184
    @ekaterinazakimatova1184 ปีที่แล้ว

    When calculating "total sales" you forgot to take the quantity of sold items into account...
    00:39:43 row #7 in your table: store_id: 3, ..., quantity: 4, price: 4400
    Your query to calculate total sales for each store:
    SELECT store_name, sum(price) AS total_sales
    FROM sales
    GROUP BY store_name
    And you got that total sales for store_id 3 is 7500. While even that one row gives us 17600 = 4400 *4

  • @VijayNaramalli
    @VijayNaramalli ปีที่แล้ว

    U are the best tutor I have never seen in my life

  • @rakhiyadav7977
    @rakhiyadav7977 2 ปีที่แล้ว +1

    Perfectly explained every usage of subquery. Great work..Thoufiq..!

    • @techTFQ
      @techTFQ  2 ปีที่แล้ว

      Thank you ☺️ 🙏🏼

  • @KonradTamas
    @KonradTamas ปีที่แล้ว +2

    Thanks BILLIANT
    for the sql CURRY !!!!!!!!!!!!!!!!!

  • @sukritiguin5637
    @sukritiguin5637 2 ปีที่แล้ว

    You deserve Millions of subscribers. You will do it soon we believe on you sir.

  • @Beant1980
    @Beant1980 3 ปีที่แล้ว +1

    The best Video on TH-cam for -> Correlated Subquery, Thanks

    • @techTFQ
      @techTFQ  3 ปีที่แล้ว

      Glad you think so!
      Thank you :)