Avsnitt 4. Kapitel 5
single
Challenge: Transaction Type Breakdown
Svep för att visa menyn
Uppgift
Svep för att börja koda
Write a query that, for each month, shows the count of transactions of type 'purchase', 'refund', and 'fee' as separate columns.
- For each month in the
transactionstable, count how many transactions havetransaction_typeequal to 'purchase'. - For each month, count how many transactions have
transaction_typeequal to 'refund'. - For each month, count how many transactions have
transaction_typeequal to 'fee'. - Use
TO_CHAR(transaction_date, 'YYYY-MM')to extract the month from the date, and name this columnmonth. Show one row per month, with columnspurchase_count,refund_count, andfee_count.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 4. Kapitel 5
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal