SQL Problem - Identify Bulk Purchase Orders | SQL Window Function | Advanced Level SQL Question

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

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

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

    Please also post script for practice

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

    my approach
    with cte as (
    select *, round(avg(quantity) over(partition by order_id),0) avg ,max(quantity) over(partition by order_id) total from orders)
    select distinct order_id, total from cte where quantity >= (select max(avg) from cte);

  • @studbanda9426
    @studbanda9426 4 месяца назад +2

    mam plewse start a series from 0 to hero in SQL...i really want to learn from you

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

    with cte as (select *, round(avg(quantity) over(partition by order_id),0) avg ,max(quantity) over(partition by order_id) total from orders)
    select distinct order_id from cte where total >= (select max(avg) from cte);

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

    my approach
    it's quite lengthy when you see first but it is understandable format
    with cte1 as(
    select order_id, (sum(quantity)/count(distinct product_id)) as avg_ from e_comm
    group by order_id),
    cte2 as(
    select order_id,max(quantity) as max_ from e_comm
    group by order_id),
    cte3 as(
    select c1.order_id,c1.avg_,c2.max_
    from cte1 c1
    inner join cte2 c2
    on c1.order_id=c2.order_id)
    select order_id
    from cte3
    where max_>(select max(avg_) from cte3)
    order by order_id;

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

    Hello nishtha, I watched your hackerank sql solving videos. They were pretty good. I saw your channel is new.
    I want to know from you that what are the resources are there to learn SQL very properly. I would like
    to mention that I want to learn this by myself. can you mention some books and resources by which I can be keen at data science. THANK YOUUUUUUU

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

    If there is anything most valuable in God's treasure, it is human life. The goal of life is to understand life.

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

    i can't find script to solve my self first