Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write SQL to answer the following questions based on the Pine Valley Furniture Company database. Note: the Pine Valley database is the one containing four
Write SQL to answer the following questions based on the Pine Valley Furniture Company database. Note: the Pine Valley database is the one containing four tables (Customer, Order, OrderLine, and Product), which you can create by using CREATE_PV.txt and LOAD_PV.txt.
- Modify the Product_T table by adding an attribute QtyOnHand that can be used to track the finished goods inventory. The field should be an integer field of five characters and should accept only positive numbers.
- List the customers who live in California or Washington. Order them by zip code, from high to low.
- List the number of customers living at each state that is included in the Customer_T table.
- Display the product line ID and the average standard price for all products in each product line.
- For every product that has been ordered, display the product ID and the total quantity ordered (label this result TotalOrdered). List the most popular product first and the least popular last.
- For each customer, list the CustomerID and total number of orders placed.
- 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.
- For each customer who had more than two orders, list the CustomerID and the total number of orders placed.
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