Confirmation Rate | Leetcode 1934 | Crack SQL Interviews in 50 Qs

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

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

  • @learnwithchirag
    @learnwithchirag  7 месяцев назад

    Hey there! 👋 For more interesting content, tutorials, and updates, Feel free to connect with me on
    Instagram Handles :-
    @createwithchirag - instagram.com/createwithchirag/
    @learn.with.chirag - instagram.com/learn.with.chirag/
    LinkedIn: www.linkedin.com/in/chirag-sehgal-9200111b8/
    Let's stay connected and keep the creativity flowing! 💡

  • @dataman17
    @dataman17 6 месяцев назад +1

    loved the way how you broke it down step by step and showed us output and also pointed out the errors. Signs of a great teacher who are hard to find. Thank you!

    • @learnwithchirag
      @learnwithchirag  6 месяцев назад +1

      Glad you enjoyed it!...Do share with your friends too 🎉💐

  • @srushtikale7455
    @srushtikale7455 Месяц назад

    Great Explanation
    I finally understood aggregate function for confirmation_rate

  • @CHIRAGARORA-gj4cr
    @CHIRAGARORA-gj4cr 17 дней назад

    Informative video

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

    we can do using avg() also
    select s.user_id, ROUND(AVG(CASE WHEN c.action = 'confirmed' THEN 1 ELSE 0 END), 2) as confirmation_rate
    from signups as s
    left join
    confirmations as c
    on s.user_id=c.user_id
    group by s.user_id

  • @civilizedmonster
    @civilizedmonster 10 месяцев назад +1

    Great, Thank you!

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

      Glad it was helpful to you 😄. Keep watching :-)

  • @arpitadeshmukh210
    @arpitadeshmukh210 6 дней назад

    Any idea why my round function doesn't work in MS SQL server
    with cte as(
    select s.user_id, isnull(count(c.user_id),0) as total
    from signups s
    left join confirmations c
    on s.user_id = c.user_id
    group by s.user_id)
    select c.user_id,
    confirmation_rate =
    case when total = 0 then 0
    else round((select count(user_id) from confirmations where action = 'confirmed')/total,2)
    end
    from cte c

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

    Great Explanation Bhaiya !!!!

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

      Your comments keep me motivated! Keep Learning & Supporting:-)

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

    Thanks for the solution. Can you please solve this problem in postgressql ? I am getting divided by zero error.

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

    Amazingly Explained!!

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

      Glad it was helpful! Keep Learning 💯💐

  • @apoorvpradhan5125
    @apoorvpradhan5125 3 месяца назад

    Thank you bhaiya.

  • @Meme_-883
    @Meme_-883 4 месяца назад

    nicely explained

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

    bhai best explanation

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

    Can we use AVG(c.action='confirmed')?

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

      Using AVG(c.action='confirmed') wouldn't give you the desired result because AVG() calculates the average of numeric values. The expression c.action='confirmed' evaluates to either true or false (1 or 0 in MySQL's boolean context), not a numeric value that AVG() can operate on.

  • @AnuragSingh-jh2ot
    @AnuragSingh-jh2ot 9 месяцев назад +1

    why we can't use count() instead of sum() in the numerator

    • @learnwithchirag
      @learnwithchirag  8 месяцев назад +6

      The 'COUNT()' function in SQL counts the number of rows in a result set, and it does not work with conditional expressions like action = 'confirmed' directly inside it.
      If you want to count the number of rows where action is 'confirmed', you typically need to use a conditional statement within the 'SUM()' function.

    • @ninadthawait4458
      @ninadthawait4458 7 месяцев назад

      I had the same doubt, amazing explanation of the problem and doubt indeed! Keep going Chirag!

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

      @@learnwithchirag THANKS FOR THE EXPLANATION

  • @vaibhav5269
    @vaibhav5269 5 месяцев назад +1

    you didn't write c.action,but it still worked in 1st line

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

      why did it work? since action is unique column?