bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1069. Product Sales Analysis II

1069. Product Sales Analysis II

Leetcode Solutions

Aggregating Total Quantity Sold per Product

  1. Select the product_id and quantity columns from the Sales table.
  2. Group the selected data by product_id to prepare for aggregation.
  3. Use the SUM() function to calculate the total quantity sold for each product_id.
  4. Rename the aggregated quantity column to total_quantity using the AS keyword.
  5. Return the result set with product_id and total_quantity.
erDiagram
    Sales {
        int sale_id
        int product_id
        int year
        int quantity
        int price
    }
    Product {
        int product_id
        varchar product_name
    }
    Sales }|--|| Product : has

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...