with
t1 as(
    select
        product_id,
        product_name,
        type,
        price,
        dense_rank()over(partition by type order by price desc) as drank
    from
        product_info
)

select
    product_id,
    product_name,
    type,
    price
from
    t1
where
    drank<=2
order by
    price desc,
    product_name
limit
    3