Секція 1. Розділ 20
single
Challenge: Customer Spending Analysis
Свайпніть щоб показати меню
Завдання
Swipe to start coding
Write a query that shows, for each customer, the total 'purchase' and 'refund' amounts as separate columns.
- Select
customer_idfrom thetransactionstable. - Calculate the sum of
amountfor transactions wheretransaction_typeis 'purchase' and display it astotal_purchase. - Calculate the sum of
amountfor transactions wheretransaction_typeis 'refund' and display it astotal_refund. - Group the results by
customer_id. - Display one row per customer.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 20
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат