AMAZON SQL INTERVIEW QUESTION | Weekday puzzle

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

КОМЕНТАРІ • 11

  • @ragulmarley4900
    @ragulmarley4900 11 днів тому

    Nice bro 😊 way u teaching do some video basic to advance sql sir

  • @sravankumar1767
    @sravankumar1767 13 днів тому

    Superb explanation 👌 👏 👍

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

    What if there are duplicates? Can I just add a row_number as id and do the joins based that id. Does that solve the problem for duplicates?

  • @ragulmarley4900
    @ragulmarley4900 11 днів тому

    How to add this combination table do we need to create sir

    • @datasculptor2895
      @datasculptor2895  11 днів тому

      We need to create it. Script is there in the description

  • @gsrsakhilakhil528
    @gsrsakhilakhil528 12 днів тому

    bro dax meeda videos start chey bro

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

    Here i tried solving it using MYSQL
    with recursive cte as (
    select days,length(days) - length(replace(days,",","")) +1 as cnt
    from combination
    union
    select days,cnt-1
    from cte
    where cnt >1),
    cte2 as (
    select *,
    substring_index(substring_index(days,",",cnt),",",-1) as wrd
    from cte
    )
    select days,
    max(if(wrd="F",'TRUE',null)) as friday,
    max(if(wrd="M",'TRUE',null)) as monday,
    max(if(wrd="R",'TRUE',null)) as thursday,
    max(if(wrd="S",'TRUE',null)) as saturday,
    max(if(wrd="T",'TRUE',null)) as tuesday,
    max(if(wrd="U",'TRUE',null)) as sunday,
    max(if(wrd="W",'TRUE',null)) as wednesday
    from cte2 as c1 join weeks as w
    on c1.wrd = w.letter
    group by days

  • @chandramohan-bo5se
    @chandramohan-bo5se 13 днів тому

    Bro..
    With out pivot..
    Tell me

    • @datasculptor2895
      @datasculptor2895  13 днів тому

      Transform rows into columns WITHOUT PIVOT operator in SQL
      ua-cam.com/video/WfQGE7FQZGI/v-deo.html