Sezione 2. Capitolo 2
single
Challenge: 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
salestable to calculate the total sales for each product. - In a nested subquery inside the FROM section, group sales by
product_idand sum thetotal_amountfor 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
productstable to get the product name and the total sales. - The result should display the product name and its total sales.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 2
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione