Answered step by step
Verified Expert Solution
Question
1 Approved Answer
10. List the department ID, department name, count of sales reps, and average commission rate for each department. Group by department, and sort by
10. List the department ID, department name, count of sales reps, and average commission rate for each department. Group by department, and sort by average commission rate in ascending order. Show the average commission rate as a percentage (e.g., 3.5% instead of .035). Use the following column headings: DeptID, DeptName, SalesRepCount. AvgCommRate 11. List the sales rep ID, first name, last name, department name, commission class and commission rate for all sales reps that earn a commission greater than 0%. Sort by sales rep ID in ascending order. 12. List the sales rep ID, first name, last name, department ID, and department name for all sales reps whose commission class is 'A.' Concatenate the first and last names together, using SalesRep Name as the column heading. Sort by department ID then by sales rep ID. 13. List the order ID and calculated total for all products sold in order 104. Format the total as currency. Use the following column headings: Qrder ID, Order Total 14. List the average product price of all products sold, formatted as currency. Use Avg Price as the column heading. 15. List the product ID, product name, and current product price for the product(s) sold in more orders than any other products (based on number of order occurrences, not the quantity). Format the price as currency, and use the following column headings: ProductID, Name, Price. 16. List the category ID, product ID, product name, and current product price for the lowest priced product in each category. Format the price as currency, and use the following column headings: Cat JD. Prod ID. Prod Name, Price. 17. List the product ID, product name, category name, and current product price for all products which have a price greater than the average product price. Format the price as currency. 18. List the order ID, order date, customer ID, customer first name, customer last name, and customer phone number for all orders on or before 1/26/22. Combine the first and last name into one column (include a space between them). Sort by order date then by customer ID, both in ascending order. Format the date as "mm-dd-xxxx" and use the following column headings: Order ID, Order Date, Cust ID, Name, Phone. 19. List the customer ID, first name, and last name of all customers whose first names start with the letter 'A' and sort by last name. Use the following column headings: CustID, FirstName, LastName 20. List the customer ID, customer first name, customer last name, and phone number of all customers who belong to sales rep 12. Combine the first and last name into one column (include a space between them). Format the phone number as '###-###-####' by using concatenation and the SUBSTR function, and use the following column headings: Customer ID, Name, Phone. SQL Plus File Edit View Window Select SQL Plus $31 =| File Explorer SQL> SQL> --14 SQL> SELECT TO_CHAR (AVG (ProdPrice),'$999,999') AS "Avg_Price" 2 FROM PRODUCT_TRJ; Avg_Price 7 GROUP BY OD.ProdID), AS TEMP )); GROUP BY OD.ProdID), AS TEMP )) ERROR at line 7: ORA-00903: invalid table name SQL> SQL> --15 SQL> SELECT 2 FROM PRODUCT WHERE ProdID IN (SELECT OD.ProdID 3 FROM ORDERDETAIL_TRJ OD INNER JOIN PRODUCT_TRJ P ON P.ProdID GROUP BY OD. ProdID HAVING COUNT (OrderID) 4 5 (SELECT MAX(TEMP. MAXCOUNT) FROM ( SELECT COUNT (OrderID) AS MAXCOUNT 6 FROM ORDERDETAIL_TRJ OD INNER JOIN PRODUCT_TRJ P ON P.ProdID OD. ProdID OD. ProdID, ProdName AS "Name", ProdPrice AS "Price" = I (SELECT ProdCatID, Min(ProdPrice) minPrice | INNER JOIN (Q) = OD. ProdID = (SELECT ProdCat ID, Min (ProdPrice) minPrice FROM PRODUCT_TRJ GROUP BY ProdCatID ) b ON a. ProdCat ID = b. ProdCatID AND a.ProdPrice = b. minPrice ; < SQL> SQL> --16 SQL> SELECT a.ProdCatID AS "Cat_ID", ProdID AS "Prod_ID", ProdName AS "Prod_Name", TO_CHAR(ProdPrice, '$999,999') AS "Price" 2 FROM PRODUCT_TRJ a 3 INNER JOIN 4 407 CH X 00 Activate Windows --17 SELECT ProdID AS "Product_ID", ProdName AS "Product_Name", ProdCat Name AS "Category", TO_CHAR ( ProdPrice, G$999,99919 SAS Pricee Windows. CROM DRADUCT TOn TANED TATM DRODCAT TDT DC ON DC Dunda+TD - D DAC+TO Sun Dec 4 9:26 PM SCOLA HIF A
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started