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

single

bookChallenge: Customer Purchase Aggregation

Swipe um das Menü anzuzeigen

Aufgabe

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ösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 3. Kapitel 2
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt