Question
Based on this textbook problem from here: https://www.chegg.com/homework-help/processing-database-data-statements-brewbean-s-application-n-chapter-3-problem-3hap-solution-9781133947363-exc Processing Database Data with IF Statements The Brewbeans application needs a block to determine whether a customer
Based on this textbook problem from here: https://www.chegg.com/homework-help/processing-database-data-statements-brewbean-s-application-n-chapter-3-problem-3hap-solution-9781133947363-exc
Processing Database Data with IF Statements
The Brewbeans application needs a block to determine whether a customer is rated HIGH, MID, or LOW based on his or her total purchases. The block needs to select the total amount of orders for a specified customer, determine the rating, and then display the results onscreen. The code rates the customer HIGH if total purchases are greater than $200, MID if greater than $100, and LOW if $100 or lower. Use an initialized variable to provide the shopper ID.
1. Start SQL Developer, if necessary.
2. Open the assignment03-03.sql file from the Chapter03 folder. Review the partial block. Edit the block to perform the required task.
3. Run the block and verify the results. Enter and run the following SQL query to confirm that the total for this shopper is indeed greater than $200:
SELECT SUM(total)
FROM bb_basket
WHERE idShopper = 22
AND orderplaced = 1
GROUP BY idshopper;
4. Test other shoppers who have a completed order.
DECLARB 1v_total_num NUMBER (6,2); 1v_rating_txt VARCHAR2 (4); 1v_shop_num bb_basket.idshopper*TYPE:= 22 ; BEGIN SELECT SUM(total) FRaM bb basket WHIBRB idShopper = AND orderplaced =1 GROUP BY idshopper; IF 1v_total_num >200 THIN BND IF; DBMS_OUIPUT.PUT_LINE ('Shopper ' _g_shopperli'is rated ' 1v rating_Ext); BIN; DECLARB 1v_total_num NUMBER (6,2); 1v_rating_txt VARCHAR2 (4); 1v_shop_num bb_basket.idshopper*TYPE:= 22 ; BEGIN SELECT SUM(total) FRaM bb basket WHIBRB idShopper = AND orderplaced =1 GROUP BY idshopper; IF 1v_total_num >200 THIN BND IF; DBMS_OUIPUT.PUT_LINE ('Shopper ' _g_shopperli'is rated ' 1v rating_Ext); BINStep 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