select
    t1.store_id store_id,
    t1.store_name store_name,
    t2.product_category product_category,
    inventory_quantity,
    sales_amount
from
    stores t1 join sales_inventory t3 on t1.store_id = t3.store_id
    join products t2 on t2.product_id = t3.product_id
where
    inventory_quantity < 10 and sales_amount > 5000
order by
    t3.store_id, t3.product_id