Lec-68: Correlated Subquery in SQL with Example | Imp for Placements, GATE, NET & SQL certification

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 พ.ย. 2024

ความคิดเห็น • 181

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

    A voice comes from the heart that thanks you so much sir ☺️🙏

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

    Ur all videos make my journey easier to learn DBMS and SQL .I can confidently write in my resume about DBMS SQL .Thank you so much sir.🙏✨❣️🌸

    • @GauravKumar-ok1yp
      @GauravKumar-ok1yp 3 ปีที่แล้ว +7

      placement mila ???

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

      th-cam.com/video/5FsIa4Mp3ho/w-d-xo.html🙏🏻🙏🏻

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

      ​@@GauravKumar-ok1ypyes Pooja work in my company

    • @batuklal
      @batuklal 11 หลายเดือนก่อน

      @@GauravKumar-ok1yp.,

  • @PradeepYadav-fg2yg
    @PradeepYadav-fg2yg 3 ปีที่แล้ว +5

    sir u simply explain lot of tough concepts with ease and nice example.,highly humbled sir thanxx for teaching the way u teach...

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

    Very useful topic sir nice explanation thank you sir

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

    I have never seen such a great explanation, so far I was very confused with EXISTS AND NOT EXISTS operators but after watching these video my doubts are cleared....thank you very much Guru Ji

  • @komalika1576
    @komalika1576 6 วันที่ผ่านมา

    sir the way uah explained in minutely that is tremendous.

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

    we can also use this simple subquery - SELECT * FROM Emp where Eid IN ( SELECT Eid FROM Dept )

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

      right, but i have one question what if dept table consists multiple same e_id.

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

      @@adnanbedsur just add distinct keyword in dept table

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

    what a great person . love from Pakistan

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

    Best way of explaining this correlated subquerywith exist that u gave sir.. 1 row of table 1 compared with all rows of table 2 ....🙏🙏🙏👏👏👏👏😍😍😍

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

    No words to express my feelings...simply thxx aloott🙏

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

    👏👏👏 So simplified. dhanyawad Bhai 👏

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

    Gurujee shandar jabardast zindabaad

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

    Thank you so much sir...i m on the right channel.....its quite easy to learn SQL..so now i m confident enough to apply for jobs

  • @sarthikbangroo6097
    @sarthikbangroo6097 12 วันที่ผ่านมา

    I was not aware of this correlated query. Thanks much Sir🙏 ❤

  • @manashranjan1267
    @manashranjan1267 5 ปีที่แล้ว

    Great Explanations Sir...Thanks Very Much for nice explanation...

  • @SwetaKumari-mw2gq
    @SwetaKumari-mw2gq 3 หลายเดือนก่อน

    thank you very much sir for making this video i have been struggling in subquery for many days but now my doubt is clear .this is the best video on subquery .

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

    Sir you explained co-related subqueries in a very accurate and brief manner. Thanks allot.

  • @NOORKHAN-gt5ry
    @NOORKHAN-gt5ry 4 ปีที่แล้ว +2

    Thank you sir for support in DATA BASE

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

    u r such a great person sir.

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

    One of the Best Teachers in the world❤❤❤

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

    For those wondering why * has been used in the inner query, this is what I understood:
    for each row of the employee table we are comparing with all the rows of the department table by using(dept.eid = emp.eid), because it may be possible that a single employee is working in more than one department. In lecture 62 while using exists one mistake was using E_id in front of where which is not required while using WHERE and NOT WHERE. Other than that in lec 62, the query was correct, there we were not comparing one row of employee table with all row of project table because it was not required( at least one project)
    Hope this helps, also please reply if you think there is some mistake.

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

      instead * you can just use 1 there in nothing connection between result and select statement in nested query

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

      As a sir said exist which used it comapre or scan whole eid coloum.... So no need to use*

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

    Thank u so much sir for such a simple yet detailed explanation 👏

  • @sajansekhu8785
    @sajansekhu8785 4 ปีที่แล้ว

    Great explanation sir..Thnkk u so much sir..Stay blessed..🙏🙏

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

    Sir apke video bhut strength deta hai interview crack karne k liye...🙏please please plsql ka v series baniye specially package , procedure , function likhne ka tricks dijiye...
    Please sir...
    🙏

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

    Thanku so much sir ❤️❤️❤️
    Beautiful lecture on co related queries .. now concept is clear ❤️❤️❤️❤️

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

    Nice video to understand correlated nested query..thanks sir.plz make more videos related to SQL queries

  • @PranavSharma-q9w
    @PranavSharma-q9w 2 หลายเดือนก่อน

    sir you got a new subscriber😇
    appka dhanayavad sir ji🙏

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

    Just one word. Amazing

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

    3:19 video starts

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

    thank you sir for giving great knowledge

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

    Thanks for this video sir

  • @Iamtrk1993
    @Iamtrk1993 5 ปีที่แล้ว

    Great video...Sir

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

    Super Explanation

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

    Khup chan sir

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

    Thanks a lot bro.. I understood it.
    Now I can decode complex correlated subqueries.🙏

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

    there are some mistakes in your syntex, but it's not a big problem... we just here to understand how it works. Thank you for your valuable videos🙏✨❣️🌸🙏✨❣️🌸

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

      What's the mistake ?

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

      ​@@rahulshingne1963he also don't know what is mistake 😂

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

    Nicely explained .. Thank you!

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

    👍 thanks 😊

  • @RishiRap
    @RishiRap ปีที่แล้ว +12

    You repeated lots of same info but still failed to explain as to outer table will compare inner table with all rows regardless of if one match is already made or will it stop comparing once a match is made.

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

      He told that if one is true then it will return true and for exist only one true is required so it terminates. It is as same as || in C++, it only checks if one of condition is true.

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

      Agree...

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

    Super explanation

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

    Love from Afghanistan, thank u sir for ur great explanation 👍

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

    love from canada

  • @komalgupta356
    @komalgupta356 5 ปีที่แล้ว

    Very nice Mr. Mind hacker

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

    It would be very helpful if the videos was in English so everybody could understand

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

    Amazing

  • @namratanikam7566
    @namratanikam7566 4 ปีที่แล้ว

    Great😊

  • @sanaullahkhan1988
    @sanaullahkhan1988 4 ปีที่แล้ว

    great sir ...

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

    great explanation boss: )

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

    I really appreciate yr hardwork and I know it takes a lot to KEEP creating content for us irrespective of how many are actually subscribing and helping u grow too ❤

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

    Mja aa gya

  • @pradeepsingh-sj7qf
    @pradeepsingh-sj7qf 4 ปีที่แล้ว +2

    Super super

  • @AM-oe7ix
    @AM-oe7ix ปีที่แล้ว

    Thanks for the explanation. We can get the same result using joins as well. So what is the advantage, since the processing time for corelated or sync queries are more.

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

    sir first of all thnq you so much for providing such type of amazing content , your teaching style is superb cant be described ,,
    i have a doubt
    select * from dept will also print complete details of department table
    i want to say that along with emp ,dept table details will also print
    i am correct ?????
    Am i right?

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

      I had same doubt, and I think it should be Eid instead of *.

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

      select *from dept will check whether the condition is true In this table sir is E_id as Primary Key and E_id frm department sir is using Foregin key

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

      th-cam.com/video/5FsIa4Mp3ho/w-d-xo.html🙏🏻

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

    Is Eid missing before exist in this query??plz clarify varun sir

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

    Its been 1 continuous months hearing your voice in ×2...Now i can recognise you even in my sleep😅

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

    Sir highly appreciate your efforts,I am new learner S when we have IN optrator which works same then why to use exits.

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

      In operator ignores null values in that particular set and exists gives only boolean values either true or false hence scaning on data base is reduced and improves performance

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

    Good bro

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

    Thank You Sir.

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

    sir kabhi link de bhi diya kro video mai bolke jokes apart thankyou so much for all the videos

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

    Thank you sir...I have a doubt, in the example we have written solution as 'where exists' but in previous videos we used 'where e_id exists'. Both are correct??

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

      No, in the previous video, there was a mistake.

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

    Thanks sir

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

    Sir bs aap ase hi help krte rho

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

    Thankyou sir

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

    Thank you

  • @suchetabhatia4473
    @suchetabhatia4473 4 ปีที่แล้ว

    Thanku sir

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

    I found an alternative solution for this question...
    Select * from Emp where Eid In (Select Eid from Dept);
    Will it be also applicable?

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

      Ofc but he's talking abt correlated queries. Why'd he write a query with "in" here?

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

    Nice

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

    Hello Sir ! Can we write IN in place of EXISTS after WHERE clause ?

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

    SUPERBBBBBB

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

    Great video !
    Can this query perform the same task yours
    " Select * from Emp where Eid IN ( Select Eid from Dept) "

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

      yes, it will give same result.

  • @satyaswarupsamal1571
    @satyaswarupsamal1571 6 วันที่ผ่านมา

    Sir ine doubt the question you mentioned in this video .. will it print the details of the inner query i.e. Dname or not

  • @alaminice8538
    @alaminice8538 4 ปีที่แล้ว

    Sir plz uplod a class about RAID for DBMS

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

    upload some videos about what type of questions will asked in gate 2020 in dbms

    • @Gamechanger..601
      @Gamechanger..601 5 ปีที่แล้ว

      Go and check his channel... its already there

  • @Padne_ki_Pulia1234
    @Padne_ki_Pulia1234 5 ปีที่แล้ว

    Sir Gate aur Net ke important questions karwa dijiye

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

    What operator can we use instead of exist

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

    sir difference between exist and IN . please.

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

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

    Sir isme
    select * from emp where Eid exits
    Hoga na ?

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

    Sir ye esa nhi hoga kya??👇
    ... Where eid exists (...
    Sirf ...where exists (...
    Kyo lagaya?

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

    domain relation calculus pe vidios hai kya sir.

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

    a doubt what if i ended up making my demo table which include emply detail n department in it ? on what basis one can say we had to make diff table.

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

    Kindly clear my one doubt..
    we have used * in inner query then also in output dept name is not printed..why?

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

      Yes same doubt??

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

      Anyone can reply plzz?

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

      @Pragati Gupta
      If * is used then all the attributes which are present in the outer query Are present in the resulting table with those attributes
      If specific attribute we need then Directly we can excess by presenting the attributes

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

      th-cam.com/video/5FsIa4Mp3ho/w-d-xo.html🙏🏻🙏🏻

  • @031-madhu3
    @031-madhu3 2 ปีที่แล้ว

    arrange in order

  • @ravisharma-ze7dk
    @ravisharma-ze7dk 3 ปีที่แล้ว

    Sir ye aap imagine kiye leki employee table me hi all colum exist kare tab Hume department table ki koi jarurat nahi fir kaise kare sir

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

    Sir u don't have written Eid before using Exists
    The right ans is
    SELECT * FROM EMP WHERE EID EXISTS(SELECT EID FEOM DEPT WHERE EMP.EID = DEPT EID);

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

    But if I want the dept name as well so what would be query for this in correlated subquery

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

    So what's the difference between in and exists?

  • @himasaila5439
    @himasaila5439 4 ปีที่แล้ว

    In inner query' select eid 'should be there know sir...

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

    Sir if I want to include Department name also in details of employee than what will be the query ?

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

    And if we want department name also
    Then what will be the Qry?

  • @065_abhinavkumar6
    @065_abhinavkumar6 ปีที่แล้ว

    can we use in instea of exists?

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

    Hello Sir,
    I have a query if we need to print Eid, Name, Address and Dname, then is it possible to edit and get it via this query itself?

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

      With using table alias and using alias for department table you can modify your query.

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

    In inner query there is select* . what will it print?

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

    Sir kya Inner Query mein * Ki jagah Eid likh skte hain

  • @SHASHANKRUSTAGII
    @SHASHANKRUSTAGII 4 ปีที่แล้ว

    Evaluate this

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

    😀💯

  • @shrikantdharpawar317
    @shrikantdharpawar317 4 ปีที่แล้ว

    Sir , what is the independent sub query??

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

    when gate smashers is there
    there is no failing chance in college exams

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

    Hi Varun Sir,
    in your code,
    "
    SELECT * FROM EMP
    WHERE EXISTS (SELECT * FROM Dept WHERE d.EID = e.EID);
    Why have we not put anything after WHERE?
    Like, could it not be "WHERE EID EXISTS (SELECT * FROM Dept WHERE d.EID = e.EID);"?
    PLEASE CLARIFY, SIR.
    "

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

      1st query is correct... 2nd query is wrong bcoz of syntax

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

      @@vijyalaxmiwadle6317 in previous video sir wrote as WHERE Eid thats why i had a doubt can you clarify

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

    Sir ek question hai ... previous exits
    ot exits video Mai select Eid from emp where eid exits tha but isme where k baad eid kyu nhi likha gya ?

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

      typo. there will be eid before exist