Nested Queries | SQL | Tutorial 18

Поділитися
Вставка
  • Опубліковано 25 сер 2024
  • 🦒❤️ www.giraffeaca...

КОМЕНТАРІ • 154

  • @benweber3388
    @benweber3388 4 роки тому +95

    Writing the queries separately and then combining them made the logic of nested queries much easier to understand. Nice vid!

    • @AD-do2rs
      @AD-do2rs 2 роки тому +2

      Indeed .

    • @descobra5462
      @descobra5462 6 місяців тому

      This guys way of teaching is amazing

  • @DannyMontealegre22
    @DannyMontealegre22 5 років тому +39

    Couldn’t figure out my problem.. watched this video.. then solved my problem in less than 2 mins. Thx dude!

  • @marcusg5665
    @marcusg5665 4 роки тому +25

    I feel Jim and Dwight sell more than Michael at any given time.
    Great video!

  • @isisdominguez4776
    @isisdominguez4776 2 роки тому +13

    OMG, I was struggling with Nested subqueries, but now I certainly have a better insight about it. Thank you so much and the person who shared your video in a forum.

  • @TheRealAK786
    @TheRealAK786 3 роки тому +5

    Came for nested queries, stayed for the dataset. Love it thanks

  • @anthonyover
    @anthonyover 4 роки тому +18

    YES!!!! Thank you. This was really clear. Taking my first database class via Zoom, needing all the help I can get lol!

  • @Pen_Da
    @Pen_Da 6 місяців тому

    This made me understand the concept of nested queries better and quicker. The approach you conveyed within 5 mins is effective. Thank you so much

  • @TheMinaProject
    @TheMinaProject 2 роки тому +2

    THANK YOU! BEST tutorial out there! Had no idea what was going on it class for the past 40 minutes and you sorted it in 10 😂

  • @juanfernandomoyanoramirez600
    @juanfernandomoyanoramirez600 2 роки тому

    I come here from the google data analytics professional certificate and this video allowed me to understand this new concept. Thank you very much.

  • @eishaamir5601
    @eishaamir5601 2 роки тому

    Love how you used people from the Office!!!

  • @nesreen1978
    @nesreen1978 4 роки тому +1

    I feel I should be contributing to your channel of how beneficial it is to me, thank you, Mike!

  • @beizhou1614
    @beizhou1614 Рік тому +2

    Thank you! Your explanation is so clear!

  • @elij8852
    @elij8852 5 років тому +4

    Great tutorials man. I have an internship coming up in just over a week. These videos are making me feel prepped for it.

  • @tejdeepak8092
    @tejdeepak8092 Рік тому +1

    hey mike, thanks for explaining the complex topic in SQL nested query!

  • @alex-sd
    @alex-sd 2 роки тому +1

    Awesome explanation for nested or subqueries. Thanks so much!

  • @lebzgold7475
    @lebzgold7475 2 роки тому

    Thanks for simplifying the logic behind this!

  • @guitardude1007
    @guitardude1007 5 років тому +2

    Lol love The Office examples. Great informative video

  • @SunshineFromWithin
    @SunshineFromWithin 2 роки тому +1

    Fantastic videos, all of them. Thank you for doing this.

  • @JohnSmith-ok9sn
    @JohnSmith-ok9sn 3 роки тому +1

    Mike... You are the M-A-A-AN!!!
    Thank you, so much!
    This was so clearly and simply esplained!
    On top of everything, I was working on understanding the consecutiveness of the steps machine is working in, as it evaluates the query, and I saw, (in my mind), that it worked from inside-out of the parentheses - in other words, from within the innermost parentheses' query, gradually, toward the outermost query - but, I had seen some conflicting, (to a novice, like me), explanations and examples before, and wasn't entirely clear on this.
    And YOU, Sir, did it so clearly, and eloquently!
    Thank You!

  • @parmarrutik7845
    @parmarrutik7845 2 роки тому

    nice video i want this types of more scenerio base questions solutions

  • @giving1106
    @giving1106 7 місяців тому

    Very good breakdown, thank you!

  • @sviatoslavslivinskiy9330
    @sviatoslavslivinskiy9330 3 роки тому +1

    Such a great tutorial.
    Thanks, man!

  • @hildakamiza3947
    @hildakamiza3947 5 років тому +1

    you have helped alot .. clear and understandable explaination

  • @shahzainahmed6851
    @shahzainahmed6851 2 роки тому

    u are so good tbh , very clear

  • @popoporiBN
    @popoporiBN 2 роки тому

    believe it or not our database design lecturer did not use practical example like this and just read of what syntaxes does from textbook. holy i just understood it in a minute!

  • @muneebbolo
    @muneebbolo 6 місяців тому

    Love ♥ this tutorial
    Keep it up!

  • @mmm-bj8zg
    @mmm-bj8zg Рік тому

    Taught me something my teacher couldn't, appreciate it

  • @sabatinosalsano743
    @sabatinosalsano743 4 роки тому +2

    in these cases would be more simple just using the join statement

  • @rokunuzjahanrudro7571
    @rokunuzjahanrudro7571 Рік тому

    Great explanation!!!

  • @davidsmith6028
    @davidsmith6028 10 місяців тому

    Awesome video, thanks so much

  • @mibo747
    @mibo747 3 роки тому

    Wow.... what a clarity of explanation

  • @jbizzy4829
    @jbizzy4829 10 місяців тому

    This was so helpful! Thanks

  • @balrajvirdee1087
    @balrajvirdee1087 Рік тому

    Great video 👍🏽

  • @ChicaSonidera
    @ChicaSonidera 2 роки тому

    Great content, thanks.

  • @asrEthio
    @asrEthio 3 роки тому +1

    Please make mor vedios on Database we need it!

  • @mr.goldenball333
    @mr.goldenball333 2 роки тому

    Thank you. It really helps!

  • @mashawickramasinghe195
    @mashawickramasinghe195 Рік тому

    Great video!!!👏

  • @safiya1363
    @safiya1363 3 роки тому +1

    Can I just say a HUGE thank you as I was stuck on this one coursework question

  • @thecritico
    @thecritico Рік тому

    Subscribed!!! Great videos with C and now SQL.

  • @rshad4ever
    @rshad4ever 3 роки тому

    omg, this is better than my professor

  • @Shiyounin
    @Shiyounin 3 роки тому

    Thanks, Dane, you're Great.

  • @simplemente_humano
    @simplemente_humano 3 роки тому

    Great video! Step by step, clear, organized! good job! Just subscribed!

  • @HiruniAbeysekara-fl1ij
    @HiruniAbeysekara-fl1ij 4 дні тому

    Great sir❤🎉

  • @TheGoldenriff
    @TheGoldenriff 5 років тому +9

    Can we also just use an inner join?
    Select * from employee inner join works_with where total_sales > 30,000 ?

    • @lawrencew8243
      @lawrencew8243 4 роки тому +1

      I'm new to this stuff and wondering the same thing..

    • @TheBorjj
      @TheBorjj 4 роки тому

      Any answers?

    • @jain4613
      @jain4613 4 роки тому +2

      yes it gives the same result

    • @edinelezi7691
      @edinelezi7691 4 роки тому

      Any nested correlated query can be rewritten as a normal query, it says in the book Fundamentals of Database Design.

  • @dawitworku821
    @dawitworku821 4 місяці тому

    Very helpful. Than you.

  • @e3uz
    @e3uz 4 роки тому +1

    If in client there was not mng_id, is that a good query for the last exercise?
    SELECT client_id, client_name
    FROM client
    WHERE client_id IN (
    SELECT client_id
    FROM works_with
    WHERE emp_id IN(
    SELECT emp_id
    FROM employee
    WHERE super_id IN (
    SELECT mgr_id
    FROM branch
    WHERE mgr_id IN (
    SELECT emp_id
    FROM employee
    WHERE employee.first_name = 'Michael' AND employee.last_name = 'Scott'
    )
    ) OR (first_name = 'Michael' AND last_name = 'Scott')
    )
    )

  • @DEEPAKS0306
    @DEEPAKS0306 3 роки тому

    Being an office fanatic....i understood it better🤣👍👌

  • @itsdaj
    @itsdaj 3 роки тому +1

    Great video, just one problem though. You do not have Dwight in the employee table. :)

  • @SRISAILAPUBRAHMAJIBCE
    @SRISAILAPUBRAHMAJIBCE Рік тому

    nice explanation 😇 sir

  • @alcarajo61
    @alcarajo61 8 днів тому

    I liked the vid. You explain very well! However, isn't it a video for subqueries? I'm new to SQL but i'm under the impression you would have to go one step inner to get a nested query, right?

  • @cybervee_
    @cybervee_ 5 років тому

    your explanation helps me a lot, thank you so much!

  • @stevodoe4900
    @stevodoe4900 5 років тому

    So, is it bad I didn't recognize the "re-brand" and my first thought was come on some guy stole "Mike's" video?? And, here I was going to subscribe. After a brief look at the videos, I realized my mistake and pounded that sub button. Because anyone with a hunger for computer knowledge this is a good place to start. The tutorials are simple and easy to follow for beginners and more advanced users.

  • @alisonlarson4882
    @alisonlarson4882 5 років тому +6

    When is it more appropriate to use a nested query over a join? Or is it preference?

    • @djataberk1
      @djataberk1 5 років тому

      Great question

    • @danjones9999
      @danjones9999 4 роки тому

      Anyone?

    • @linda33528
      @linda33528 4 роки тому

      literally my question and I can't find an answer either :)

    • @WarrenCromartie2
      @WarrenCromartie2 4 роки тому +1

      Yes, a very good question. I would have used a table join for the first example in this tutorial, but as I'm relatively new to SQL, I assumed there was either a good reason not to, OR he was merely trying to demonstrate a principle.

  • @thrang_eo
    @thrang_eo 6 років тому +1

    Very Well Explained Sir ♥️♥️ Thank You

  • @chalmerilexus2072
    @chalmerilexus2072 3 роки тому +1

    You are a Star...

  • @god-speed03
    @god-speed03 24 дні тому

    Life was good when we were giraffe academy's students

  • @Enkumnu
    @Enkumnu Рік тому

    Thank you. Help a lot

  • @sonamuhialdeen7866
    @sonamuhialdeen7866 3 роки тому

    Amazing tutorial

  • @jethalalnhk2409
    @jethalalnhk2409 3 роки тому

    very nicely explained thank you

  • @RealityCheck6T9
    @RealityCheck6T9 4 роки тому

    Thanks, good video

  • @mrinalmishra1437
    @mrinalmishra1437 2 роки тому

    Just wow ❤🙏🙏🙌

  • @Jahrhcy
    @Jahrhcy 4 роки тому

    Great explanation! Thank you.

  • @christopherrahme780
    @christopherrahme780 5 років тому +2

    Assuming you don't know Michael Scott's ID:
    -- Clients handled by Michael Scott's branch
    SELECT client_name FROM client WHERE branch_id IN
    (SELECT branch_id FROM branch WHERE mgr_id IN
    (SELECT emp_id FROM employee WHERE first_name = "Michael" AND last_name = "Scott"));
    -- Or you can do
    SELECT client_name FROM client WHERE branch_id IN
    (SELECT branch_id FROM branch WHERE mgr_id IN
    (SELECT emp_id FROM employee WHERE CONCAT(first_name, " ", last_name) = "Michael Scott"));

  • @anuradhajha9798
    @anuradhajha9798 3 роки тому

    thanks, wonderful session.

  • @queryhsje7514
    @queryhsje7514 Рік тому

    Hi, thanks for the video! Sorry I don't get it why in the first example you were using 'IN', while in the 2nd example you were using '='? Can you explain a little detail, please? Thanks.

  • @elifece7847
    @elifece7847 5 років тому +2

    can you give more questions for nested queries?

  • @rootcause5322
    @rootcause5322 2 роки тому

    This was lit 🔥 Thank u bruh...

  • @ujjawal6660
    @ujjawal6660 5 років тому +1

    thnk u so much sir

  • @user-hc5kq6zd1n
    @user-hc5kq6zd1n 4 роки тому

    Thank you for the explanation ! :D

  • @julian.castro18
    @julian.castro18 3 роки тому

    Thank you!

  • @yuneecorn
    @yuneecorn 4 роки тому

    I wish I can give a million likes for this video. Thank you.

  • @bradleynguyen1429
    @bradleynguyen1429 3 роки тому

    May I asked why you would not use an IN with the client branch ID in the where clause, I don’t understand why parenthesis would used in this sense. Thank you

  • @mohammadmayar5544
    @mohammadmayar5544 2 роки тому

    Can you make video of if condition and while loop as well please

  • @lillycyriac6972
    @lillycyriac6972 5 років тому +2

    Explanation are helpful but I do have one question.. isn't the first question to find out employees for a single client.. not sure the query address the question

    • @thesmallplateau
      @thesmallplateau 4 роки тому

      I guess he means all employees who have sold +3k to one client (not a specific client). So if we have an employee who sold 1500 to a client and 1500 to another client should not be counted

  • @sriramch5157
    @sriramch5157 11 місяців тому

    We can use inner join

  • @joelnada3483
    @joelnada3483 3 роки тому

    Thank you very much bro....

  • @ravikhatri24
    @ravikhatri24 4 роки тому

    You are the best man ,👌

  • @angelikm6142
    @angelikm6142 3 роки тому

    Thanks you

  • @missdhara6434
    @missdhara6434 3 роки тому

    I have an exam tomorrow this whole nested queries thing can get pretty complicated if you dont under stand the basics of the dos and don'ts and when to use certain functions with nested queries.

  • @shreyansraghu6709
    @shreyansraghu6709 2 роки тому +1

    Hi, I liked working on the data camp, are there any websites with a lot of tables and questions to solve more problems and practice?

  • @dimitrisapostolakis8669
    @dimitrisapostolakis8669 4 роки тому

    if you dont assume you know michael scott id cant you just do it through employee table?
    for exp
    select client.client_name from client
    where client.branch_id = (
    select employee.branch_id from employee
    where first_name='Michael' and last_name='Scott'
    //you could use LIKE instead of =
    limit 1);

  • @ericskelton5191
    @ericskelton5191 3 роки тому +2

    Great video, but how dare you not even include Dwight in the employee table

  • @WarrenCromartie2
    @WarrenCromartie2 4 роки тому

    Very clearly explained. I'm just getting to grips with SQL, so forgive my ignorance! Would you use a nesting approach if you wanted to retrieve relational data for over 1000 items using Oracle where you can't input more than 1K items in a single search? Or is there a more efficient way of querying large numbers of inputs using Developer? Hope that makes sense :-)

  • @demetridoes
    @demetridoes 3 роки тому

    thank you so much!

  • @recklessvelociraptor2579
    @recklessvelociraptor2579 2 місяці тому

    6:11 why it is called foreign key?

  • @DJJSerpico
    @DJJSerpico 5 років тому

    great job! Contributed!

  • @hanmwahx268
    @hanmwahx268 3 роки тому

    Thank you so much dude

  • @nadeemzeaiter1995
    @nadeemzeaiter1995 3 роки тому

    respect!

  • @LoreCraftForge
    @LoreCraftForge Рік тому

    Can you do this if your trying to pull from separate dbos? Or do I have to create a view with the info from each dbo I need?

  • @leeeric6292
    @leeeric6292 2 роки тому

    To make it simple, why don't use "in" in all cases?

  • @azddinebouarbi4948
    @azddinebouarbi4948 2 роки тому

    bravo

  • @Commander_HW
    @Commander_HW 3 роки тому

    my profs couldn't even explain this as clear and you, and i paid her for the class.........

  • @akj3388
    @akj3388 2 роки тому

    In the very first subquery example, how would you display the client id as well along with employee's first and last name? I am happy if it repeats the name.

  • @mateuszgrzonka3826
    @mateuszgrzonka3826 4 роки тому

    Please come back Mike!

  • @ndzalama1
    @ndzalama1 4 роки тому

    Great examples, how can one play with that data (online practice

  • @bradleynguyen1429
    @bradleynguyen1429 3 роки тому

    Would it make a huge difference if the branch manager query was the outer query, and the client withing the nested query?

  • @laurenrackley4336
    @laurenrackley4336 3 роки тому

    Can you do another video on a nested query but with group by? I am trying to use SQL to count adverse events for a clinical trial.

  • @tucomax
    @tucomax 3 роки тому

    Can't watch the video... There is an error when I try to play it.

  • @EzeChiappero
    @EzeChiappero 2 роки тому

    Just 30 minutes ago, I upload a doubt. With the help of a mate, I got the answer right the way, great community!

  • @svens3722
    @svens3722 Рік тому

    i need this with calculated columns. any suggestions?