Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Top Customers by Order Count | Subqueries in E-commerce Analytics
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Subqueries in SQL

bookChallenge: Top Customers by Order Count

Tarefa

Swipe to start coding

Write a query to identify the top 3 customers who have placed the highest number of orders. Use a subquery to count the number of orders for each customer and then select the top 3 customers based on this count.

  • Use a subquery to calculate the number of orders for each customer.
  • Join the result of the subquery with the customers table to retrieve customer details.
  • Select only the top 3 customers with the highest order counts.
  • If there are ties in order counts, order customers by their customer ID in ascending order.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 3
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

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

Suggested prompts:

Can you explain that in simpler terms?

What are the main benefits of this approach?

Are there any common mistakes to avoid with this?

close

bookChallenge: Top Customers by Order Count

Deslize para mostrar o menu

Tarefa

Swipe to start coding

Write a query to identify the top 3 customers who have placed the highest number of orders. Use a subquery to count the number of orders for each customer and then select the top 3 customers based on this count.

  • Use a subquery to calculate the number of orders for each customer.
  • Join the result of the subquery with the customers table to retrieve customer details.
  • Select only the top 3 customers with the highest order counts.
  • If there are ties in order counts, order customers by their customer ID in ascending order.

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 1. Capítulo 3
single

single

some-alt