Seksjon 4. Kapittel 5
single
Challenge: Transaction Type Breakdown
Sveip for å vise menyen
Oppgave
Sveip for å begynne å kode
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
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 5
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår