Sección 3. Capítulo 2
single
Challenge: Customer Purchase Aggregation
Desliza para mostrar el menú
Tarea
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
customersandsales_transactionstables oncustomer_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.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 3. Capítulo 2
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla