Question: Write a SELECT statement that uses the analytic functions to get the highest and lowest sales by product within each category. Return these columns: The

Write a SELECT statement that uses the analytic functions to get the highest and

lowest sales by product within each category. Return these columns:

The category_name column from the Categories table

The product_name column from the Products table

A column named total_sales that shows the sum of the sales for each

product with sales in theOrder_Items table.

A column named highest_sales that uses the FIRST_VALUE function to

show the name of the product with the highest sales within each category.

A column named lowest_sales that uses the LAST_VALUE function to

show the name of the product with the lowest sales within each category.

This is using the schema below, thanks!

Write a SELECT statement that uses the analytic functions to get the

2 Administrators AdminID EmailAddress Password FirstName LastName OrderItems ItemID OrderID Productio ItemPrice DiscountAmount Quantity Addresses AddressID Customer Line! Orders Orderin CustomerID Order Date ShipAmount TexAmount ShipDate ShipAddressID Card Type Card Number CardExpires BillingAddress Line2 City State ZipCode Phone Disabled Products ProductID CategoryID Product Code Product Name Description ListPrice DiscountPercent Date Added 8 Categories CategoryID CategoryName Customers Customer Email Address Password First Name LastName ShippingAddressID BillingAddressID

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!