-- 1. Išvardinkite klientus be užsakymų per paskutinį mėnesį.
-- Struktūra:
-- customers (customer_id, name, registration_date)
-- orders (order_id, customer_id, order_date, amount)
SELECT DISTINCT c.customer_id, c.name
FROM customers c
LEFT JOIN orders o
ON c.customer_id = o.customer_id and o.order_date >= DATE_TRUNC('month', CURRENT_DATE) - INTERVAL '1 month')
WHERE o.amount IS NULL
-- 2. Apskaičiuokite kiekvienos pogrupio dalį bendroje kategorijos pajamose
-- sales (product_id, category, subcategory, revenue, sale_date)
-- Tikėtinas rezultatas: category | subcategory | share_of_category