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

single

bookChallenge: Customer Purchase Aggregation

Glissez pour afficher le menu

Tâche

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.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 2
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt