Challenge: Customer Spending Analysis
Taak
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.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 4. Hoofdstuk 2
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 4.17
Challenge: Customer Spending Analysis
Veeg om het menu te tonen
Taak
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.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 4. Hoofdstuk 2
single