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

single

bookChallenge: Top-Selling Products

Scorri per mostrare il menu

Compito

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 2
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt