Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Customer Purchase Aggregation | Advanced CTE Applications and Performance
/
Mastering Common Table Expressions (CTEs) in SQL
Seção 3. Capítulo 2
single

single

bookChallenge: Customer Purchase Aggregation

Deslize para mostrar o menu

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 2
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt