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

  • @SP-fc9bx
    @SP-fc9bx 2 года назад +2

    You are so awesome! SQL came late for me in life but learning all these cool tricks is helping a LOT

  • @agape13
    @agape13 2 года назад +3

    Queen 👑 !
    Excellent channel and teaching skills 🏆

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

    We can apply having clause count(OrderID) is Null to filter out the missing dates

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

    Superb explanation 👌 👏

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

    Every helpful video, nice way of explanation 👍

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

    Awesome content❤

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

    nice approach. I have another doubt:
    How to use/fill the record for missing dates from the previous dates ?
    like 10th January is the missing date then how can we make use of values on 9th jan and copy for 10th jan and generate a new table with all the dates ?

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

      Thank you for your comment. The forward fill approach is the topic for our next video coming this week. Stay tuned and please Subscribe 🙏

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

      We can use lag window function

  • @adityaraopandrapagada1894
    @adityaraopandrapagada1894 2 года назад +2

    Great Solution... I have a requirement: I have a cities column with or without duplicates. I need count of cities start with each alphabet. If there is no city with any alphabet it should be shown as zero. Can you help me out @LearnAtKnowstar ?

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

      You can perform a count by extracting first letter of each city..ex - Left(Cityname,1)

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

      Create a CTE with the list of all alphabets A-Z and perform a left join with the CTE on the first alphabet of column city

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

      @@LearnatKnowstar I wrote a query for firstname in Person.Person table, please lemme know whether my approach is correct or not.
      With t1 as (select row_number() over(order by object_id) as Alp from sys.columns),
      t2 as (select char(((Alp-1)%26)+65) alpha from t1 where Alp

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

      Looks perfect! Only not sure why there is group by on firstname for t3. Other than that, this should be giving the correct results.

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

      Thanks for mentioning this scenario. This is an interesting idea for us to cover in our video tutorials!

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

    Nice explained 💐

  • @bobgamble8204
    @bobgamble8204 2 года назад +2

    A CTE is not the same as a temporary table. It just isn't.

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

    Ty mam...

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

    Thanks

  • @Niteshkumar-ly2ip
    @Niteshkumar-ly2ip Год назад

    Can you please share the scripts of this example?

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

    Hi, Please explain to create temp table with first 12 days in each month of a year

    • @judelaw12
      @judelaw12 6 месяцев назад

      Don't, simply create a dates table, every DB should have a dates tables created.
      Just link to that table. Get a script online and select first 12 days for each month from that table.

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

    Super stuff

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

    Thanks for the video, but I have a small problem when I'm creating dates month wise, its not resulting proper, its adding 30 days to each date, and with this it results this way
    2016-12-31 00:00:00.000
    2017-01-31 00:00:00.000
    2017-02-28 00:00:00.000
    2017-03-28 00:00:00.000
    Declare @startdate date='2016-12-31';
    Declare @endate date ='2022-7-31';
    With dates as
    (
    select @startdate as transactiondate
    union all
    Select dateadd(mm,1,transactiondate)
    from dates
    where dateadd(mm,1,transactiondate)

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

      This is because you're using month (mm) in the datepart for DATEADD fn this will increment the month by the number to add specified.
      Use dateadd(dd,1, transactiondate) and it will solve your problem.

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

    Sequence generation is very easy in MySQL: SELECT seq FROM seq_1_to_31

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

    How to find duplicate data without using Group by clause

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

    Maximum recursion = 100, a longer sequence can't be generated.

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

      The value can be changed by specifying MAXRECURSION: SELECT OrderDate from Dates OPTION (MAXRECURSION NNN);
      MAXRECURSION >= 0 and

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

    Where was this video 3 months ago. I came to a similar solution but I was struggling as a newbie.

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

    it is doesn't work in MySQL.

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

    Thanks