Write Complex SQL Queries 2 | Cricket Analytics | Interview questions with Solution |

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

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

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

    Hi Data Enthusiasts, how many of you are able to solve this problem? Do you have any other solution to this problem statement?

  • @michadobroczynski7599
    @michadobroczynski7599 Год назад +3

    Appreciate your great work! Working on real examples is best method for learning, thanks!

    • @analyticalguy
      @analyticalguy  Год назад +2

      Thanks Michal, yes it is true, working on real life projects will help in becoming job ready.

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

    Thank you so much

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

      You're most welcome. I am happy you got benefitted from this video.

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

    Thank you for sharing. This was really helpful in understanding How you break down the syntax and the problem with the solution. Looking forward to seeing more practice videos. Also, how do you find practice queries like this one ?

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

      I’m glad you liked this video. Hey there is only one way to learn these queries - Practice. Once you start practising then you would automatically get the solution. Practising the solve and not cramming is the way to go ahead.
      Thanks for your input 👍

  • @surajkumarsaw7398
    @surajkumarsaw7398 10 месяцев назад

    I was confused first then I saw that you are applying case with comparison winner column then wrote solution hit.
    with cte as (
    select home_team,
    case when home_team = winner then 1 else 0 end as winner_flag
    from cricket_tournament
    union all
    select away_team,
    case when away_team = winner then 1 else 0 end as winner_flag
    from cricket_tournament
    )
    select home_team, count(home_team) as total_matches_played, sum(winner_flag) as matches_won, count(case when winner_flag=0 then 0 end) as Matches_lost
    from cte group by home_team order by home_team