Learn & Practice SQL Complex Queries | 10 examples (Must DO for Interviews)

Поділитися
Вставка
  • Опубліковано 11 січ 2025

КОМЕНТАРІ • 66

  • @LearnatKnowstar
    @LearnatKnowstar  Рік тому +3

    Need more tips and pointers to solve SQL Complex queries. Check out our latest video below -
    ua-cam.com/video/YKHFhZJDw-o/v-deo.html

  • @jubedahmed1750
    @jubedahmed1750 10 днів тому

    This is the perfect video anyone will be looking for.. like while we see a question what all ways we can do a question is what everyone need as some people ask for different approaches. Thank you please do a lot like these videos.

  • @saransubramani-cp1jp
    @saransubramani-cp1jp 2 роки тому +2

    I thought sql was tough until I watch this video. Thanks for the wonderful explanation.

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

    Excellent explanations. Thank you for sharing

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

    You the only destination for Datastage developer. I have cleared lots of interviews seeing your videos only. Please add the script for those questions. So that it will be helpful for practice.
    Thanks🙏

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

      Thank you. The scripts are available here -
      know-star.blogspot.com/2022/09/how-to-write-complex-sql-queries.html?m=1

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

    Very useful information. Very helpful for our preparation. Please do more videos like this. Thankyou

  • @rasanivr
    @rasanivr 3 місяці тому +1

    Thanx for the great examples and clear explanations ❤

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

    Wow , great video as usual and questions were also good. Thanks a lot 🙏

  • @successfulvictorypublisher6090

    Excellent coverage! Looking forward to plenty more queries -- I genuinely love this! Here's hoping that you can create more and more training series -- Basic, Intermediate and Advanced plus super-duper Complex examples! Dhanyawad! AWESOME!

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

    I just subscribed this channel after seeing this video.. Wonderful explanation..
    I would suggest to make similar kind of scenarios questions videos playlist for PL/SQL also.

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

    Thank you very much for your effort. I wish you success in your life

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

    Great video. Explaining how to think logically is very helpful.

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

    Thank you for the video. That is how, step by step, the tasks should be solved!
    However, solution #4 is not correct because the number of employees with the same salary can be more than 2. Universal solution:
    SELECT EmployeeID
    ,FullName
    ,DeptID
    ,E.Salary
    FROM Employees E INNER JOIN (SELECT Salary
    FROM Employees
    GROUP BY Salary
    HAVING Count (Salary) >1) MS ON E.Salary = MS.Salary

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

      Thanks for sharing this. This is a great solution.

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

    Amazing content. Please post more of such detailed videos!

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

    I think more efficient approach - rather than joins or multiple subqueries is CTE with window function like rank or avg or max partitioned by dept etc.

  • @AkashDeep-ux1ig
    @AkashDeep-ux1ig 2 роки тому

    Gr8 vdo thnx for ur efforts

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

    2nd question can be solved using co related sub query.
    Select e.employeeID, e.DeptID, e.Salary from emp e where e.sal < (select avg(sal) from emp e2 where E1.deptno=e.deptno);

  • @abhaysingh-ve6gg
    @abhaysingh-ve6gg 2 роки тому

    Really very helpful.

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

    Hey there,
    God bless your efforts.
    I have come through the term concurrence in sql, what does it actually means?
    Thanks for taking time to clarfifying this to me.

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

    Good explanation thank you

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

    Superb!

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

    great video, you've gained a subscriber, but it will be great to have the scripts so i can tag along, the links in the description isn't going through

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

      Thank you. You can find the sql statements and dataset here - know-star.blogspot.com/2022/09/how-to-write-complex-sql-queries.html?m=1

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

    wow great keep it up, i will be grateful if you could tell how to get this database to my sqlserver so i can practice after watching
    sincerly

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

      Thank you.The dataset and sql links are in the description.

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

    Good

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

    I'm getting "Cannot insert explicit value for identity column in table 'Employees' when IDENTITY_INSERT is set to OFF." ERROR

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

    In the syntax of creating the table how you refer the managerId by using empID. I think there is a wrong syntax.

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

    in your screen query not visible properly becouse of latest ouput.

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

      All queries are provided in the link in the description box. Hope it helps.

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

    can you pls give me the data set script so that we can try practice

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

      You can find the practice dataset and sql queries here -
      know-star.blogspot.com/2022/09/how-to-write-complex-sql-queries.html

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

    Mam, how can I get better in SQL server?

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

      Practice SQL queries and try writing them in your own.

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

    Is the solution for Question 3 - "Employees with Salary less than the Department's Average Salary - But Higher than the Average of ANY OTHER Department's Salary" - compatible with all RDBMS ? " > ANY " is supported in all RDBMS ? Can someone help with other solutions. Thank You

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

    Ma'am please reduce size of characters.. can't see full query at a time

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

      Will keep in mind. Thank you for bringing this to our attention.

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

    --SHORT QUERY
    WITH CTE AS( SELECT EMPID , DEPTID , SALARY ,ROW_NUMBER()OVER(PARTITION BY DEPDID ORDEER BY SALARY) AS RANK) FROM EMP)
    SELECT * FROM CTE
    WHERE RANK = 1

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

    wow

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

    Waise agar Hindi me ki hoti sure like Jayada subscribe hota but English hi without style bolo

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

    hi make a video 15 to 20 minutes

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

      Sure, we will be making medium length videos as well 👍

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

    10th problem statement is poorly worded.

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

    Bhai samajh aarhi toh padhlo warna dusre channel follow krlo...
    Inka channel hai inki marzi...

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

    Madam tum log style me ku bolte ho jra acche se bolo n

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

    your script showing error

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

    Simpler solution for 9th one:
    SELECT * FROM
    (WITH cte AS
    (SELECT
    e.deptid AS EMPDEPT,
    0.90 * AVG(salary) AS AVGSAL
    FROM employees e
    GROUP BY e.deptid
    )
    SELECT *, ROW_NUMBER() OVER(PARTITION BY deptid) AS rownum
    FROM employees e1 JOIN cte c ON e1.deptid = EMPDEPT AND e1.salary > AVGSAL
    ) temp
    WHERE rownum >= 2;