Таблица customer_rfm (id, name, days_since_last_order INTEGER, order_count INTEGER, total_spent REAL). Сегментируйте клиентов по RFM: Champions (R<=30, F>=10, M>=50000), Loyal (R<=60, F>=5), At Risk (R>90, F>=3), Lost (R>180). Остальные — Regular. Выведите name, days_since_last_order, order_count, total_spent, segment.
CREATE TABLE customer_rfm (id INTEGER PRIMARY KEY, name TEXT, days_since_last_order INTEGER, order_count INTEGER, total_spent REAL);
CASE WHEN AND