LeetCode Medium 1532 Interview SQL Question with Detailed Explanation

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

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

  • @Hkumar_new
    @Hkumar_new 7 месяцев назад +1

    your video intro..I'll say..." I like it " ❤

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

      Haha, yeah I just keep trying different things here and there.

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

    can't we use Group by instead of window function brother?

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

      Hmm, so if you perform a join then group by say customer_id, how will you get the latest 3 orders? Any thoughts? How will the SQL query look like in that case?

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

      Give error ,says no agrigate fun used here , 😅

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

    with cte as (select customer_id, order_id, order_date,
    RANK() OVER(partition by customer_id order by order_date desc) as rnk from ordors),
    cte2 as(select customer_id, order_id,order_date from cte where rnk