Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will not be working with the group by clause and aggregate functions using MysQL Remember that MySQL does not find all errors when using

image text in transcribedimage text in transcribed

You will not be working with the "group by" clause and aggregate functions using MysQL Remember that MySQL does not find all errors when using the "group by" function. You will need to double check your output to make sure it is correct. 6. Create a view called SALES_DATA_Vthat displays the customer ID, orderid, item ID, Order date, product ID, Product description, and Item total (in the item table) for the order. This is a join using the ORD, ITEM and PRODUCT tables. Do NOT use an aggregate function yet. Watch for ambiguous columns. 7. Using the SALES_DATA_V view, display the data in the view sorted by customerID 8. Using the SALES_DATA_V view to display Customer id and the grand total sales for each customer (using an aggregate function). Give the grand total a column name Grand Total. 9. Now join the SALES_DATA_Vview to the CUSTOMER table to display the customer last name and last name along with the grand total sales for each customer (using an aggregate function). Caveat: If you want to include the first name as well, then you need to modify your Group By clause to provide it correctly. Rememberthat MySQLallows errors in the Group By clause. 10. Create a view called SALES_PER_DEPT V that includes only the employee ID (sales rep), employee last name, employee first name, order id, department number, and total for each order. Do NOT include the Depttable. You will use the Dept table later. This is a join. You will need to join three tables. Watch for ambiguous columns 11. Create a query to display the data in the SALES_PER_DEPT_V view sorted by employee id (sales rep) in ascending order 12. Create a query using the SALES_PER_DEPT V view and the appropriate aggregate functionto display the number of sales for each sales rep LAST NAME. Give the aggregate function column the name NUMBER_OF_SALES; 13. Create a join query using the SALES_PER_DEPT_Vview and the DEPT table to display the department name along with the average sales for each department. Sortthe report by the department name in descending order. Round the average sales amountto the nearest dollar. Emp Dept PK EmpNo PK Deptno LName Dname Fname Job Customer HireDate PK CustID Sal LName Comm FName FK De ptno Street Ord City PK Ordid StateZip OrderDate Phone FK CustID FK RepID ShipDate Total Item PK Ordid Product PK ItemID PK Prodid FK ProdID Descrip QTY ProdPrice Item Tot

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions