Challenge: Customer Spending Analysis
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 4. Chapitre 2
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Génial!
Completion taux amélioré à 4.17
Challenge: Customer Spending Analysis
Glissez pour afficher le menu
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 4. Chapitre 2
single