Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Transaction Type Breakdown | CASE WHEN for Aggregates and Reporting
Mastering CASE WHEN in SQL

bookChallenge: Transaction Type Breakdown

Oppgave

Swipe to start coding

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 transactions table, count how many transactions have transaction_type equal to 'purchase'.
  • For each month, count how many transactions have transaction_type equal to 'refund'.
  • For each month, count how many transactions have transaction_type equal to 'fee'.
  • Show the results with one row per month, and columns for the month, purchase count, refund count, and fee count.

Løsning

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 5
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

bookChallenge: Transaction Type Breakdown

Sveip for å vise menyen

Oppgave

Swipe to start coding

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 transactions table, count how many transactions have transaction_type equal to 'purchase'.
  • For each month, count how many transactions have transaction_type equal to 'refund'.
  • For each month, count how many transactions have transaction_type equal to 'fee'.
  • Show the results with one row per month, and columns for the month, purchase count, refund count, and fee count.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 5
single

single

some-alt