Database: department_store
Question: What are the ids of all products that were either ordered more than 3 times or have a cumulative amount purchased of above 80000?
SQL:
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