Question
Use the db_pvfc12_big database in Teradata SQL Assistant. Create a .SQL file that provides queries to the following Problems in the textbook: 10) 5-69. For
Use the db_pvfc12_big database in Teradata SQL Assistant. Create a .SQL file that provides queries to the following Problems in the textbook:
10) 5-69. 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.
11) 5-70. For each order, display the order ID, the number of separate products included in the order, and the total number of product units (for all products) ordered.
12) 5-71. For each customer, list the CustomerID and total number of orders placed.
13) 5-72. For each salesperson, display a list of CustomerIDs.
14) 5-73. 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.
15) 5-74. For each payment made on or after March 10, 2018, list PaymentID, OrderID, PaymentAmount, and the first 10 characters of PaymentComment.
16) 5-75. For each customer, list the customer ID and the total number of orders placed in 2018.
17) 5-76. For each salesperson, list the total number of orders.
18) 5-77. For each customer who had more than two orders, list the CustomerID and the total number of orders placed. 19) 5-79. List all sales territories (TerritoryID) that have more than one salesperson.
20) 5-80. Which product is ordered most frequently?
The database is as followed:
Book Pine Valley Furniture Company (PVFC) Datasets
Customer_T
CustomerID, CustomerName, CustomerAddress, CustomerCity, CustomerState, CustomerPostalCode
1, 'Contemporary Casuals', '1355 S Hines Blvd', 'Gainesville', 'FL', '32601-2871'
2, 'Value Furniture', '15145 S.W. 17th St.', 'Plano', 'TX', '75094-7743'
3, 'Home Furnishings', '1900 Allard Ave.', 'Albany', 'NY', '12209-1125'
4, 'Eastern Furniture', '1925 Beltline Rd.', 'Carteret', 'NJ', '07008-3188'
5, 'Impressions', '5585 Westcott Ct.', 'Sacramento', 'CA', '94206-4056'
6, 'Furniture Gallery', '325 Flatiron Dr.', 'Boulder', 'CO', '80514-4432'
7, 'Period Furniture', '394 Rainbow Dr.', 'Seattle', 'WA', '97954-5589'
8, 'California Classics', '816 Peach Rd.', 'Santa Clara', 'CA', '96915-7754'
9, 'M and H Casual Furniture', '3709 First Street', 'Clearwater', 'FL', '34620-2314'
10, 'Seminole Interiors', '2400 Rocky Point Dr.', 'Seminole', 'FL', '34646-4423'
11, 'American Euro Lifestyles', '2424 Missouri Ave N.', 'Prospect Park', 'NJ', '07508-5621'
12, 'Battle Creek Furniture', '345 Capitol Ave. SW', 'Battle Creek', 'MI', '49015-3401'
13, 'Heritage Furnishings', '66789 College Ave.', 'Carlisle', 'PA', '17013-8834'
14, 'Kaneohe Homes', '112 Kiowai St.', 'Kaneohe', 'HI', '96744-2537'
15, 'Mountain Scenes', '4132 Main Street', 'Ogden', 'UT', '84403-4432'
Order_T.
OrderID, OrderDate, CustomerID
1001, '21/Oct/10', 1
1002, '21/Oct/10', 8
1003, '22/Oct/10', 15
1004, '22/Oct/10', 5
1005, '24/Oct/10', 3
1006, '24/Oct/10', 2
1007, '27/Oct/10', 11
1008, '30/Oct/10', 12
1009, '05/Nov/10', 4
1010, '05/Nov/10', 1
Product_T.
ProductID, ProductDescription, ProductFinish, ProductStandardPrice, ProductLineID
1, 'End Table', 'Cherry', 175, 1
2, 'Coffee Table', 'Natural Ash', 200, 2
3, 'Computer Desk', 'Natural Ash', 375, 2
4, 'Entertainment Center', 'Natural Maple', 650, 3
5, 'Writers Desk', 'Cherry', 325, 1
6, '8-Drawer Desk', 'White Ash', 750, 2
7, 'Dining Table', 'Natural Ash', 800, 2
8, 'Computer Desk', 'Walnut', 250, 3
OrderLine_T.
OrderID, ProductID, OrderedQuantity
1001, 1, 2
1001, 2, 2
1001, 4, 1
1002, 3, 5
1003, 3, 3
1004, 6, 2
1004, 8, 2
1005, 4, 4
1006, 4, 1
1006, 5, 2
1006, 7, 2
1007, 1, 3
1007, 2, 2
1008, 3, 3
1008, 8, 3
1009, 4, 2
1009, 7, 3
1010, 8, 10
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