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.

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

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); BIN

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!