Understanding ALL ANY or SOME in SQL || Lesson 89 || DBMS || Learning Monkey ||

Поділитися
Вставка
  • Опубліковано 2 лют 2020
  • Here we will try to discuss Understanding ALL, ANY or SOME in SQL.
    Understanding ALL ANY or SOME in SQL
    Definitions of ALL, ANY or SOME: ALL, ANY or SOME are keywords. These keywords are used with WHERE or HAVING Clause.
    ALL, ANY or SOME operates on the subqueries that return multiple values. ALL returns true if all subquery values meet the condition. ANY or SOME returns true if any of the subquery values meet the condition.
    To understand this let's consider the employee table of the company database
    Understanding ALL Keyword:
    Now consider the query with the use of ALL " SELECT fname FROM employee WHERE salary ALL (20000, 25000, 30000); ".
    What do the above query states?
    The query is going to find the fname of all the employees whose salary is greater than ALL these values 20000, 25000, and 30000.
    How this query works is it takes the salary value in each and every row and is compared with all the values given (20000, 25000, 30000).
    If the salary in the row is greater than ALL the values then the fnames will be displayed.
    Understanding ANY or SOME Keyword:
    Consider the same query used with ANY " SELECT fname FROM employee WHERE salary ANY (20000, 25000, 30000); ".
    What do the above query states?
    The query is going to find the fname of all the employees whose salary is greater than ANY of these values 20000, 25000, and 30000.
    How this query works is it takes the salary value in each and every row and is compared with all the values given (20000, 25000, 30000).
    If the salary in the row is greater than ANY the values then the fnames will be displayed.
    In place of we can use SOME also.
    Example Query on ALL, ANY or SOME:
    Find the fnames and lnames of all the employees whose salary is greater than all the employees in department number 5.
    In order to execute this query, we have to find the salaries of all the employees in department number 5. Then those values are to be compared with every employee salary.
    The answer to the query is " SELECT fname, lname FROM employee WHERE salary ALL (SELECT salary FROM employee WHERE dno = 5); ".
    The output of the inner query is the salaries of the employees who are working in department number 5 (30000, 40000, 38000, 25000).
    Now every employee's salary is compared with ALL the employee's salary of the department number 5.
    If the value of the salary is true for all the values then those fname and lname are considered.
    Link for our website: learningmonkey.in
    Follow us on Facebook @ / learningmonkey
    Follow us on Instagram @ / learningmonkey1
    Follow us on Twitter @ / _learningmonkey
    Mail us @ learningmonkey01@gmail.com

КОМЕНТАРІ • 79

  • @adityakhedekar9669
    @adityakhedekar9669 3 роки тому +14

    best video, searched everywhere for understanding the concept of all and any but no-one was better than you. Understood 100%

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

      Thanks for your wonderful words. It's good to hear that.
      Have a great learning.

  • @katchie242
    @katchie242 9 місяців тому

    Just perfect!!! Exactly what I have been looking for. Thanks a lot

  • @arvindabd1901
    @arvindabd1901 4 роки тому +3

    Very good explanation! Thank you !

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

    Great video, loved your series ! Thanks for sharing !!!

  • @Victoria-dh9jp
    @Victoria-dh9jp Рік тому

    God bless you, you are a life saviour. Good and clear explication.
    You are a good teacher sir.
    Continue teaching 👌

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

    Great example and Lecture :) Thank you so much!

  • @Gripex
    @Gripex 8 місяців тому +1

    Great work, thank you !

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

    Nice explanation. Searched many training materials to understand ALL and ANY Operators concept, but found this video to have exactly the right amount of information to understand the concept. Great work.

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

      Thank you have a great learning in CSE

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

    Beautiful explanation, thanks for the help mate.

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

    Nice video you have saved my time in understanding this concept

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

    Dear Sir, You are the best teacher I have ever met. Thank you so much for solving a problem that has been a big problem for me. love from Sri Lanka

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

    Thank you very much.
    Tomorrow I have a class presentation on these particular topics

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

    Thanks a lot..... U cleared all of my doubts.... Thank u

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

    Thanks you, I have searched and watched more videos but this one is completely different and I understand 100% thakns u for ur good expalination and simple example elaboration thakns yu

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

    Great sir ..you cleared my doubt🔥🔥

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

    explanation at 8:58 explains this really well! the three ANDs!

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

    Very good explanation.

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

    well explained !

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

    Great work man!!!

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

    really nice explaination bro

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

    it is a good video. Thanks!

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

    Thanks for the informative video

  • @shaiknafeesaanjum5223
    @shaiknafeesaanjum5223 Місяць тому

    Woooaahhh....best video ❤

  • @SB_Roy_Vlogs
    @SB_Roy_Vlogs 8 місяців тому

    Nice video...

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

    AWESOME!!

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

    Thanks for your hard work

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

    Good 👍

  • @mukundacs7154
    @mukundacs7154 2 роки тому +5

    Don't keep your channel name anywhere in the below, possible please keep upside anywhere,

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

    awsm

  • @rutujamane1924
    @rutujamane1924 29 днів тому

    Helpfull

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

    Thank you!

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

    great work

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

    Exellent explanation

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

    Thank u anna

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

    Hi Sir, very well explained :) Thank you very much! although i have a (silly) question - if ANY and SOME behave in identical manner, why bother having an extra operator called 'SOME'? should be just ALL or ANY. Hope that makes sense :)

  • @satyadharkumarchintagunta3793
    @satyadharkumarchintagunta3793 5 місяців тому

    Sir, thank You soo much!

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

    Sir what will be the output if we apply >= All operator instead of only >All ?

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

      It will take all those values which would be greater

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

    Very nice video apreciateable

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

    thanks

  • @NikhilKumarAngadi-sp6is
    @NikhilKumarAngadi-sp6is 3 роки тому

    Nice explanation

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

    3:08 Kya sahi time pr facebook wala ad dala hai :)

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

    Hi,
    SELECT fname, lastname
    FROM [dbo].[EMPLOYEE] AS E
    WHERE E.SALARY = ALL (SELECT EM.SALARY FROM EMPLOYEE AS EM WHERE EM.DNAME =5 )
    why this returns no data.?

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

    Thank you sir

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

    Thank you so much sir ❤️🥺

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

    Thank you

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

    What's the use if you put your channel logo right over where the important point is!?

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

    good job sir

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

    It was written that in dept no. 5 so the values of dept no. 5 would also return

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

    tnx💕💕💕💕

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

    😘🥰

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

    This was looking great until the facebook advertisement banner covered the query, making it impossible to follow. So a really good video until about the 3:05 mark, then essentially useless.

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

    Super

  • @shiamysasa986
    @shiamysasa986 8 місяців тому

    Okay, But James and Jennifer do not belong to Dno 5. Could you pls clarify the doubt?

    • @LearningMonkey
      @LearningMonkey  8 місяців тому +1

      The outer query check the entire table.

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

    Hi , I have a doubt james and jeniffer not belongs to dno 5

  • @Kid-vx9uh
    @Kid-vx9uh Рік тому

    wtf not bad

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

    not helpful, your facebook ad blocked the query, absurd

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

    Thank you