Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Customer Purchase Aggregation | Advanced CTE Applications and Performance
Practice
Projects
Quizzes & Challenges
Quizer
Challenges
/
Mastering Common Table Expressions (CTEs) in SQL
Seksjon 3. Kapittel 2
single

single

bookChallenge: Customer Purchase Aggregation

Sveip for å vise menyen

Oppgave

Swipe to start coding

Write a query using a Common Table Expression (CTE) and aggregate functions to list customers whose total purchase amount exceeds $5,000.

  • Use a CTE to calculate the total purchase amount for each customer.
  • In the CTE, join the customers and sales_transactions tables on customer_id.
  • Group the data by customer to aggregate their total purchase amount.
  • In the main query, select the customer ID, first name, last name, and total purchase amount from the CTE.
  • Only include customers whose total purchase amount is greater than 5000.

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 3. Kapittel 2
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

some-alt