230k views
0 votes
Create the following summary query: By Product Name list the following: Category Name Product Name total product sales amount - (Calculated field using the Orders Detail table: UnitPrice * Quantity) total number of products ordered - (the sum of the quantity *10 field within the Order Details table) This should be for all products with a category of ""Condiments"" or ""Beverages"" and whose order discount is 0. Filter out (remove from result set) products whose total number of products ordered is 300 or greater.

1 Answer

3 votes

Final answer:

Summary generating SQL query to report product sales and quantities for 'Condiments' and 'Beverages' categories with 0 discount, excluding products ordered 300 times or more.

Step-by-step explanation:

The student is asking for help in creating a SQL query that would generate a report from a database. The report is about summarizing product sales data filtered by category and having no discounts applied. Specifically, the student wants the report to list the Category Name, Product Name, total product sales amount, and total number of products ordered. The calculation for the total sales amount is to multiply UnitPrice by Quantity, whereas the total number of products ordered is the sum of Quantity multiplied by 10. The query needs to filter the results to only include products categorized as 'Condiments' or 'Beverages' with a discount of 0, and exclude products with a sum of quantities equal to or greater than 300.

User Kenny Kerr
by
8.2k points