Question
For this assignment, you are to create a stored procedure that returns a complete dataset to the calling program. The dataset will be based on
For this assignment, you are to create a stored procedure that returns a complete dataset to the calling program. The dataset will be based on a query that joins several tables together. The output that you produce here is very similar to a sales report that a product manager might ask for.
Your query should provide a list of customers from the TAL Distributors, along with their orders and the details of each order. Sort the output on the customer number (primary) and the order date (secondary). Include the line total for each order as "Line Total," and the last name of the sales rep that is assigned to each customer. Your output should look similar to the following:
CUSTOMER_NUM CUSTOMER_NAME ORDER_NUM ORDER_DATE ITEM_NUM DESCRIPTION NUM_ORDERED QUOTED_PRICE Line Total LAST_NAME
------------ -------------------------- --------- ---------- -------- ------------------------- ----------- ------------ ---------- ---------
126 Toys Galore 51608 2019-10-12 CD33 Wood Block Set (48 piece) 5 86.99 434.95 Campos
126 Toys Galore 51619 2019-10-15 FD11 Rocking Horse 2 121.95 243.90 Campos
260 Brookings Direct 51614 2019-10-13 FD11 Rocking Horse 1 124.95 124.95 Gradey
334 The Everything Shop 51610 2019-10-12 KL78 Pick Up Sticks 25 10.95 273.75 Tian
334 The Everything Shop 51610 2019-10-12 TR40 Tic Tac Toe 10 13.99 139.90 Tian
386 Johnson's Department Store 51613 2019-10-13 DL51 Classic Railway Set 5 104.95 524.75 Gradey
586 Almondton General Store 51617 2019-10-15 NL89 Wood Block Set (62 piece) 4 115.99 463.96 Tian
586 Almondton General Store 51617 2019-10-15 TW35 Fire Engine 3 116.95 350.85 Tian
586 Almondton General Store 51623 2019-10-15 DR67 Giant Star Brain Teaser 5 29.95 149.75 Tian
586 Almondton General Store 51623 2019-10-15 KD34 Pentominoes Brain Teaser 10 13.10 131.00 Tian
586 Almondton General Store 51623 2019-10-15 FH24 Puzzle Gift Set 12 36.95 443.40 Tian
796 Unique Gifts 51625 2019-10-16 MT03 Zauberkasten Brain Teaser 8 45.79 366.32 Tian
Step by Step Solution
3.34 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
CREATE PROCEDURE SALESVIEWREPORT AS BEGIN SELECT aCUSTOMERNUM aCUSTOMERNAME bORDER...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