Challenge: Optimizing Customer Revenue Analysis
Свайпніть щоб показати меню
Write a query that efficiently analyzes customer revenue using Materialized Views and Common Table Expressions (CTEs) on the retail_data_updated table:
- Create a Materialized View that pre-aggregates total revenue (
'total_amount') for each'customer_id'and'customer_country'. - Use a CTE to rank customers within each country based on their
'total_revenue'. - Query the Materialized View to return the top 5 customers by revenue per country.
- Sort results by
'customer_country'.
Your query should return these columns:
'customer_id'(unique customer identifier);'customer_country'(customer's country);'total_revenue'(sum of'total_amount'for the customer);
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 6
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Секція 2. Розділ 6