-- 1. Son aylar içinde sipariş vermeyen müşterilerin listesini çıkarın.
-- Yapı:
-- 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. Her alt kategorinin toplam kategori gelirlerindeki payını hesaplayın
-- sales (product_id, category, subcategory, revenue, sale_date)
-- Sonuç: category | subcategory | share_of_category