SQL Query | How to find 'n' consecutive days EXCLUDING Weekends | LAG | Windows function | streaks

Поділитися
Вставка
  • Опубліковано 16 січ 2025
  • In this tutorial, we write a SQL Query using Windows LAG function to find 'n' consecutive date records -
    1- including weekends
    2 - excluding weekends.
    The below tutorial discusses another approach to calculate
    n' consecutive days including weekends -
    • SQL tutorial | How to ...
    The practice data and SQL statements related to this tutorial are available here-
    know-star.blog...
    Register at the below link to get US $100 off for Coursera Plus membership between Sep 8 - Sep 29, 2022.
    The Coursera Plus membership gets you access to unlimited courses and unlimited certifications!
    imp.i384100.ne...
    How to install SQL Server for practice?
    • How to install SQL Ser...
    Check out the complete list of SQL Query Interview Questions -
    • SQL Query Interview Qu...
    Best Data Science / Analytics / SQL courses
    Learn SQL Basics for Data Science Specialization
    imp.i384100.ne...
    Data Science Fundamentals with Python and SQL Specialization
    imp.i384100.ne...
    Python for Everybody Specialization
    imp.i384100.ne...
    Google Data Analytics Professional Certificate
    imp.i384100.ne...
    Coursera Plus - Data Science Career Skills
    imp.i384100.ne...
    Please do not forget to like, subscribe and share.
    For enrolling and enquiries, please contact us at
    Website - knowstar.org/
    Instagram - / learn.knowstar
    Facebook - / knowstartrainings
    Linkedin - www.linkedin.c...
    Email - learn@knowstar.org

КОМЕНТАРІ • 22

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

    Register at the below link to get US $100 off for Coursera Plus membership between Sep 8 - Sep 29, 2022.
    The Coursera Plus membership gets you access to unlimited courses and unlimited certifications!
    imp.i384100.net/Ke51on

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

    You explain in such wonderful manner. It makes us so easy to understand for us. Thank you.

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

    simple superb way of explanation. Hats off to you !

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

    Awesome step by step explanation. Thank you so much 👏

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

    Amazing!! I had to do a similar query for student absent 3 consecutive school days and you helped me immensely! Thank u so much!!!

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

    Wow awesome lecture

  • @Beyondhorizons-i5z
    @Beyondhorizons-i5z 2 роки тому

    Very well explained

  • @NagaKiran-e4j
    @NagaKiran-e4j Рік тому

    Hi Mam,
    Could you please let me know for
    How to get the 7days before date from current date excluding weekends dates

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

    hi, am ur new subscriber, am learning sql watching ur videos, thanq so much, and i hav a scenario like write sql query to insert and update the latest records , could u pls explain? thanq.

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

      Glad it was helpful. Here is a tutorial that covers 3 methods to perform the upsert - update and insert operations. Hope it helps.
      ua-cam.com/video/3VO1AhrIz8M/v-deo.html

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

      @@LearnatKnowstar thanq so much for the rply, i hav one more scenario, can i?
      table A having
      col1
      A
      A
      A
      B
      B
      B
      B
      C
      C
      D
      D
      D
      D
      But output like
      col1 col2
      A 3
      A 3
      A 3
      B 4
      B 4
      B 4
      B 4
      C 2
      C 2
      D 4
      D 4
      D 4
      D 4
      How can i get two columns in output, could u pls explain? thanq.

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

      @@romonivamsi you can try this
      select Col1, Count(col1) over (partition by col1) as col2 from table

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

    Love your videos, but please can you slowdown when you are explaining "why" you are choosing a certain function. I feel like I learn a lot from your videos but sometimes why you choose certain strategies is not very clear. If we understand why you do certain functions then we can apply this in our own analysis work.

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

      Thank you for your feedback. Will surely include more explanations on the functions from now on.

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

    How am I supposed to think so critically???

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

      One needs to practice multiple SQL queries. The same tricks will be used in various scenarios.