Which products were ordered more than three times?
select * from order_items group by product_id having count(*) > 3
Which products were purchased for a total amount of more than 80000?
select * from product_suppliers group by product_id having sum(total_amount_purchased) > 80000
Find the ids of all products that were ordered more than three times or purchased for a total amount of more than 80000.
select product_id from order_items group by product_id having count(*) > 3 union select product_id from product_suppliers group by product_id having sum(total_amount_purchased) > 80000