SQL Query | Compare with Previous Quarter's sales | Analytical Functions | Lead | Lag

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 มิ.ย. 2020
  • This SQL video tutorial explains the use of analytical functions - Lead and Lag.
    Example - Compare Current Quarter's sales with Previous Quarter's sales.
    Please do not forget to like, subscribe and share.
    For enrolling and enquiries, please contact us at
    Website - knowstar.org/
    Facebook - / knowstartrainings
    Linkedin - www.linkedin.com/company/know...
    Email - learn@knowstar.org

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

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

    Great tutorial!

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

    This video is really amazing! Your hard work and knowledge really shows! Thanks a ton!! 👍

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

    These videos are so good to revise the concepts and prepare for cracking the interview.

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

    I have an interview on 4/20 and 4/21 2022. I swear I will finish all your SQL query interviews questions within 2 days, today is 4/18. fk that, I am on fire!

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

      Wishing you good luck for your interview 👍

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

      @@LearnatKnowstar thanks! I have done all leetcode question, but I just realize the most interview questions are here. THanks for posting these. I'm on fire!

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

    If I want to substract from lag(startdate) to get previous date i.e lag(start_date)-1
    Can you help?

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

    Hi sir is it possible to use LAG next in sum query? I mean LAG(sum(sales))? Thanks

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

    Great Explaination. Hooked to your channel. Could you please guide me on how we can just compare Q1 with Q4 of previous year. Thank You

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

      Hello, Please check out our latest video. it will help you with the logic
      th-cam.com/video/CDGwVXknZXI/w-d-xo.html

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

    I have question if We need only difference between q4 and q1 sales for 2019 how can we get?

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

    Your videos are great. Could you also please provide the SQL script to create the sample data and the queries? It would be really helpful for learners.

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

      Thank you. I have been planning to put the SQLs for sometime. Will be doing it soon 👍

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

    mam app agar database or table create kr ke wo v show krte to or b acha hota samjh ne may.

  • @KunalKumarSingh-wr1kg
    @KunalKumarSingh-wr1kg ปีที่แล้ว

    Excellent 👌👍

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

    Good eg

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

    Hi thanks for the video. I have a question pls. What if you wanted to compare 2019-Q1 against 2018-Q4 in the same SQL

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

      You will need to calculate quarterly sum instead of monthly and go back by an offer of 1.

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

      Here is a link to a similar video -
      th-cam.com/video/rGapnGwEWIU/w-d-xo.html

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

    Super ....

  • @SanjayKumar-yh8fd
    @SanjayKumar-yh8fd 2 ปีที่แล้ว +1

    thanks ma'am

  • @AK-Star007
    @AK-Star007 3 ปีที่แล้ว +2

    plz include video for YTD and MTD (month to date)

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

      The video is coming next week. Stay tuned.

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

    Is this playlist helpful for freshers to get job in SQL developer domain

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

      Yes, it will be helpful. You will need to practice the SQL Queries.

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

    Nice 👍

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

    Great content! Can you share the sample database you used?

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

      Thank you. Unfortunately, we do not have the database for older videos but we are including the database and sql statements for all latest videos.

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

      @@LearnatKnowstar can you share the databases you currently use for the latest videos?

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

    Please share the dataset for the same

  • @user-fi8iy6lh5z
    @user-fi8iy6lh5z ปีที่แล้ว

    A (Student ID, Student Name, Student Age)
    B (Student ID, Student Class, Student Section)
    Select Student Name, Student Class, Student Section where Student Age between 16 to 18 and Student Section is 'D'
    How to find mam ?

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

    What in case, a quarter's data is missing?

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

      It would compare with the previous quarter for which data is available.
      If we need to take into account the missing quarter, we first would need to create a dummy record for the missing quarter.

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

    Isn't it a wrong solution?
    The question was "Compare sales of quarter with previous quarter". Solution is "Comparing sales of quarter with previous quarter within same year".
    And generally, we compare quarter with previous quarter either within same financial year (i.e. Q2 with Q1) OR with same quarter in previous financial year (e.g. 2019 Q1 with 2018 Q1).

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

      3:55 "Because there is no corresponding previous quarter for that"?
      Completely wrong statement.