SQL Query | Compare monthly sales with previous month, same month previous year, first month of year

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024

Комментарии • 64

  • @LearnatKnowstar
    @LearnatKnowstar  3 года назад

    Are you interested in attending an online SQL training course?
    We have received a few inquiries and are now planning one on 18 and 19 September 2021.
    This will be a 10 hours instructor led training covering SQL concepts as well as practical SQL query writing.
    The training cost is USD 100.
    If you are interested, please register here -
    forms.gle/y2U2eKmShq6JUnc29
    Thank you 🙂

    • @mihirforyou3531
      @mihirforyou3531 3 года назад

      Mam what are the topics will be covered?

  • @saktibiswal6445
    @saktibiswal6445 Год назад

    Awesome explanation of LAG & OFFSET. Thanks!!

  • @tlubaina
    @tlubaina 3 года назад +1

    You just saved my semester! Thanks

  • @jashanpreetsingh4750
    @jashanpreetsingh4750 2 года назад

    Thanks a lot . Exactly solved the query i was having.

  • @NareskanthM
    @NareskanthM 5 месяцев назад

    Great Explanation !

  • @NareskanthM
    @NareskanthM 4 месяца назад

    thanks sister ! very easy to understand !

  • @surajpatil3579
    @surajpatil3579 3 года назад +1

    Thanks mam, splendid explanation keep making content like this!!

  • @mihirforyou3531
    @mihirforyou3531 3 года назад +1

    Thank you Mam ... very useful.. nicely explained ☺️

  • @Regc10
    @Regc10 Год назад

    This is amazing helped me alot.

  • @thatssodinesh7857
    @thatssodinesh7857 Год назад

    You're great! Thank you so much

  • @mummz3371
    @mummz3371 2 года назад

    I love watching your content because of the practical examples you use, thank you ❤️

  • @nikolaybaranov2213
    @nikolaybaranov2213 2 года назад

    Great explanation of how window functions work!

  • @chandudevarapu1578
    @chandudevarapu1578 3 года назад +1

    Thank you mam... Nice explained pls upload more videos like that... I will refer my friends also this type of scenarios very useful for us

    • @LearnatKnowstar
      @LearnatKnowstar  3 года назад

      Thanks so much. Do make sure that you and your friends subscribe to the channel 🙂

  • @brianducharme3418
    @brianducharme3418 3 года назад +1

    Thank you so very much!!

  • @pravinm1490
    @pravinm1490 Год назад

    Nicely explained

  • @ajeshrajan8079
    @ajeshrajan8079 Год назад

    Good explanation

  • @deepthimurali962
    @deepthimurali962 Год назад +1

    Can you suggest how to use lag and offset if we want to compare Jan-Feb 2022 vs Jan-Feb 2023. I basically want to sum both jan and feb and compare the growth Thanks for this!

  • @pravinm1490
    @pravinm1490 Год назад

    very nicely explained

  • @pupu41784
    @pupu41784 2 года назад

    Thank you so much. I needed this! :D

  • @kesavanandt1195
    @kesavanandt1195 2 года назад +1

    Good explanation madam...thank you very much.
    And mam, what modification is to be done in this query to get the next month sales.??

    • @LearnatKnowstar
      @LearnatKnowstar  2 года назад

      Thank you. You can use the LEAD function instead of the LAG function

  • @mmohan692
    @mmohan692 2 месяца назад

    Akka super akka

  • @Hello.1253-e8v
    @Hello.1253-e8v 3 года назад +1

    Excellent video series. Take a bow!! Could you please make something like this in Stored procs, performance tuning concepts

    • @LearnatKnowstar
      @LearnatKnowstar  3 года назад

      Thanks so much. Sure, we will be posting videos on advanced topics in near future.

  • @Tech2BI
    @Tech2BI 3 года назад +1

    As long as it's 2017 or higher versions we have functions for the same scenarios for previous versions like 2012 or 2008 r2 do you have any solution for this?

  • @jadeldeek5100
    @jadeldeek5100 2 года назад

    is possible to have monthly figures or yearly figures by columns not by row as your example? YEAR 1, YEAR 2 OR JAN, FEB , MARS ....

  • @satyapalrawat7857
    @satyapalrawat7857 Год назад

    Hi - this is very helpful. But what if there is a month missing in the last year data ?

  • @jonnybrooks97
    @jonnybrooks97 Год назад

    How can you drill down into specific columns with this, for example if you wanted to look at month on month changes for each store or region?

  • @oladman9058
    @oladman9058 Год назад

    Wow!

  • @arfathth5176
    @arfathth5176 2 года назад

    Can i know the recommended on other customer sql query

  • @vinaymaddi4801
    @vinaymaddi4801 2 года назад

    Can anyone explain the last scenario month(orderdate)-1 is taken for offset. How is that.

  • @vinayv1940
    @vinayv1940 2 года назад

    Hi , How about compare day wise sales with previous year day wise sales. ie; compare 29/9/2021 to 29/9/2022

    • @pradeepvaka2545
      @pradeepvaka2545 2 года назад

      In the offset use year instead of month Lag(sum(sales) , year(orderdate))

  • @ankurranjan3218
    @ankurranjan3218 2 года назад

    Let suppose Data does not have consecutive months data. For example I am having 2020-01 and 2020-06 data only then If I am comparing with previous month using LAG then it will not be correct, right? As it will compare June from Jan but I wanted to compare only June from May. How to proceed for this type of scenrio.

  • @rohitwaregaonkar3703
    @rohitwaregaonkar3703 Год назад

    Write a stored procedure that accepts the month and year as inputs
    Please help

  • @balamuralibattala3283
    @balamuralibattala3283 Год назад

    Hi everyone,How to find the company that has growth in three successive years.pls provide solution for it

  • @gowthamev8745
    @gowthamev8745 3 года назад

    How to calculate interview in sql for example:- customer placed an order, we have to find the customer who placed an order more than 1 within 7 days

  • @gmocore
    @gmocore 2 года назад

    tnks !!! I

  • @sivachaitanya6330
    @sivachaitanya6330 Год назад

    month(date) inside lag() function is throwing error says month should not be here in mysql ................what is the solution.........lag(sum(amount),Month(date))-------------->ERRor?????????????????

  • @advancewebdevelopment9802
    @advancewebdevelopment9802 2 года назад

    There are 897 days in query. How to get results by year months days in same query

  • @ganeshkharad
    @ganeshkharad 2 года назад

    why use lag??? what if the data for a few months in a year are absent ???

  • @smritichauhan6006
    @smritichauhan6006 11 месяцев назад

    such a ridiculous way of teaching