Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the Pine Valley Furniture Company database tables Write the appropriate SQL

ID: 3725348 • Letter: U

Question

Use the Pine Valley Furniture Company database tables

Write the appropriate SQL statement that either answers the questions or retrieves the requested values. 6-68. Display the product ID and the number of orders placed for each product. Show the results in decreasing order by the number of times the product has been ordered and label this result column NumOrders. 6-74. Measured by average standard price, what is the least-expensive product finish? 6-83. List the average number of customers per state (including only the states that are included in the Customer_T table). Hint: A query can be used as a table specification in the FROM clause.

Explanation / Answer

Answer 6-68:

SELECT Product_ID, SUM(Ordered_Quantity) AS NumOrders FROM ORDER_LINE_T GROUP BY Product_ID ORDER BY NumOrders DESC;

--------------------------------------------------------------------------------------------------------

Answer 6-74:

--------------------------------------------------------------------------------------------------------

Answer 6-83:

SELECT Customer_State, COUNT(*) AS Avg_Customers FROM CUSTOMER_T GROUP BY Customer_State;

--------------------------------------------------------------------------------------------------------