Question

Using the OrderItemProducts View, create a new View named ProductSummary. This View should return some summary...

Using the OrderItemProducts View, create a new View named ProductSummary. This View should return some summary information about each product. We want the name of the product, the number of times the product has been ordered and the total sales for the product. Use appropriate column names.

Write a SELECT statement that uses the view that you created in exercise 3 to get total sales for the five best selling products.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Create view ProductSummary as Select ProductName, count(Quantity) as OrderCountOfProduct, sum(ItemTotal) as TotalSalesOfProduct from OrderItemProducts group by ProductName;

Select TOP 5 ProductName , OrderCountOfProduct , TotalSalesOfProduct from ProductSummary group by ProductName , OrderCountOfProduct , TotalSalesOfProduct Order By OrderCountOfProduct desc ;

Do ask if any doubt. Please upvote.

Add a comment
Know the answer?
Add Answer to:
Using the OrderItemProducts View, create a new View named ProductSummary. This View should return some summary...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Table structure: administrators = admin_id, email_address, password, first_name, last_name categories = category_id, category_name customers = customer_id,...

    Table structure: administrators = admin_id, email_address, password, first_name, last_name categories = category_id, category_name customers = customer_id, email_address, password, first_name, last_name, shipping_address_id, billing_address_id order_items = item_id, order_id, product_id, item_price, discount_amount, quantity orders = order_id, customer_id, order_date, ship_amount, tax_amount, ship_date, ship_address_id, card_type, card_number, card_expires, billing_address_id products = product_id, category_id, product_code, product_name, description, list_price, discount_percent, date_added 5. Write a SELECT statement that uses regular expression functions to get the username and domain name parts of the email addresses in the Administrators table. Return...

  • (#3a){Screenshot.} Create a VIEW named ProductProfit that displays the Category Description, Product Description, and the Profit (SalePrice - Cost). Name the Category description column ‘Category’ an...

    (#3a){Screenshot.} Create a VIEW named ProductProfit that displays the Category Description, Product Description, and the Profit (SalePrice - Cost). Name the Category description column ‘Category’ and the Product description ‘Item’. The screenshot should show the SQL code to create the view and a SELECT statement displaying the records returned in descending order of the Profit column. (#3b){Screenshot.} Using the ProductProfit VIEW, display the records that are in the TOP 10 Percent of Profit. The screenshot should show the SELECT statement...

  • use workbench please Task 1: Create a database and name it practical2DB. (2 marks) Task 2:...

    use workbench please Task 1: Create a database and name it practical2DB. (2 marks) Task 2: Create all the four tables according to the relational scheme in Figure 1. (8 marks) Task 3: Insert 5 records to into each table. (5 marks) Task 4: Write a query to list alphabetically ordered names, addresses, and IDs of all the customers whose postcode is in (40150, 40400, 47500). (10 marks) Task 5: Delete 1 record from Products table using their primary keys....

  • § In BlueJ, create “New Project” named LASTNAME-company Use good programming style and Javadoc documentation standards...

    § In BlueJ, create “New Project” named LASTNAME-company Use good programming style and Javadoc documentation standards Create a “New Class…” named Company to store the employee mappings of employee names (Key) to employee ids (Value) Declare and initialize class constants MIN and MAX to appropriate values Declare and instantiate a Random randomGenerator field object Declare a String field named name for the company’s name Declare a HashMap<String, String> field named employees Add a constructor with only 1 parameter named name...

  • Create a class named Module2. You should submit your source code file (Module2.java). The Module2 class...

    Create a class named Module2. You should submit your source code file (Module2.java). The Module2 class should contain the following data fields and methods (note that all data and methods are for objects unless specified as being for the entire class) Data fields: A String object named firstName A String object named middleName A String object name lastName Methods: A Module2 constructor method that accepts no parameters and initializes the data fields from 1) to empty Strings (e.g., firstName =...

  • 7. Using the provided schema of a Purchase Order Administration database, write the following queries in...

    7. Using the provided schema of a Purchase Order Administration database, write the following queries in SQL. (In the schema, bold attributes are primary keys and italicized attributes are foreign keys.) SUPPLIER (SUPNR, SUPNAME, SUPADDRESS, SUPCITY, SUPSTATUS) SUPPLIES (SUPNR, PRODNR, PURCHASE_PRICE, DELIV_PERIOD) PRODUCT (PRODNR, PRODNAME, PRODTYPE, AVAILABLE_QUANTITY) PO_LINE (PONR, PRODNR, QUANTITY) PURCHASE_ORDER (PONR, PODATE, SUPNR) 7d) Write a nested SQL query to retrieve the supplier number, supplier name, and supplier status of each supplier who has a higher supplier status...

  • Using Swift playground and / or the command line for macOS (open Xcode, create a new...

    Using Swift playground and / or the command line for macOS (open Xcode, create a new Xcode project, macOS, command line tool), practice the following exercises: Exercise: Swift Variables Declare 2 variables/constants with some random values and any name of your choice Considering these 2 variables, one as a value of PI and other as a radius of circle, find the area of circle Print the area of circle Declare a string variable explicitly with value “Northeastern”. Declare a string...

  • The question asks to create a named range “income” that references the cell that calculates the total income in the b...

    The question asks to create a named range “income” that references the cell that calculates the total income in the budget sheet pictured above. Im just having trouble understanding since there is no total income cell. Home Insen Draw Page Layout Formulas Data Review View Help Asignment Tell me what you want to do 2 Logical AutoSum Lookup & Reference- CB Define Name Trace Precedents 9Show Formulas Recently Used A Text Math & Trig- Trace Dependents Error Checking Use in...

  • in java Create a new project named, firstInitialLastNameCS185EOS. Create and use a class that prints a title.   Create a use a menu that contains the following items, and calls corresponding methods...

    in java Create a new project named, firstInitialLastNameCS185EOS. Create and use a class that prints a title.   Create a use a menu that contains the following items, and calls corresponding methods that do the tasks the menu describes. Use classes when they're appropriate. Keep the driver class as simple as possible. Give each class, method and property simple, descriptive names using Hungarian notation. Square a number Simply pass a decimal-type number to the object that does this task. Process its...

  • need help Create or edit the SQL statements required to accomplish the following tasks. All columns...

    need help Create or edit the SQL statements required to accomplish the following tasks. All columns should have a column name, feel free to create appropriate aliases Use screen shots to ca evidence that each task is completed; include the SQL records before and after statements are executed, as appropriate. Include all work, even if you get errors. Paste your screen shots into a single PowerPoint file pture statements output from the statements, and views of the object explorer when...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT