Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

64 Incident and emergency response plans.

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago