Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Top-Selling Products | Nested Subqueries in the FROM section
Practice
Projects
Quizzes & Challenges
Quizzen
Challenges
/
Generate Nested Subqueries in SQL
Sectie 2. Hoofdstuk 2
single

single

bookChallenge: Top-Selling Products

Veeg om het menu te tonen

Taak

Swipe to start coding

Write a query to list the top 3 products by total sales using a subquery in the FROM section.

  • Use the sales table to calculate the total sales for each product.
  • In a nested subquery inside the FROM section, group sales by product_id and sum the total_amount for each product.
  • Order the results by total sales in descending order and limit the output to the top 3 products.
  • In the outer query, join this subquery result with the products table to get the product name and the total sales.
  • The result should display the product name and its total sales.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 2
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt