-- 1. Liste der Kunden ohne Bestellungen im letzten Monat.
-- Struktur:
-- 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. Berechnen Sie den Anteil jeder Unterkategorie am Gesamtumsatz der Kategorie
-- sales (product_id, category, subcategory, revenue, sale_date)
-- Erwartetes Ergebnis: category | subcategory | share_of_category