Create a new basket containing two items

Assignment Help PL-SQL Programming
Reference no: EM131378872

Assignment: Updating Columns in a Table

After a shopper completes an order, a procedure is called to update the following columns in the BASKET table: ORDERPLACED, SUBTOTAL, SHIPPING, TAX, and TOTAL. The value 1 entered in the ORDERPLACED column indicates that the shopper has completed an order. Inputs to the procedure are the basket ID and amounts for the subtotal, shipping, tax, and total.

1. In SQL Developer, create a procedure named BASKET_CONFIRM_SP that accepts the input values specified in the preceding description. Keep in mind that you're modifying an existing row of the BB_BASKET table in this procedure.

2. Enter the following statements to create a new basket containing two items: INSERT INTO BB_BASKET (IDBASKET, QUANTITY, IDSHOPPER, ORDERPLACED, SUBTOTAL, TOTAL, SHIPPING, TAX, DTCREATED, PROMO)
VALUES (17, 2, 22, 0, 0, 0, 0, 0, '28-FEB-12', 0);
INSERT INTO BB_BASKETITEM (IDBASKETITEM, IDPRODUCT, PRICE, QUANTITY, IDBASKET, OPTION1, OPTION2)
VALUES (44, 7, 10.8, 3, 17, 2, 3);
INSERT INTO BB_BASKETITEM (IDBASKETITEM, IDPRODUCT, PRICE, QUANTITY, IDBASKET, OPTION1, OPTION2)
VALUES (45, 8, 10.8, 3, 17, 2, 3);

3. Type and run COMMIT; to save the data from these statements.

4. Call the procedure with the following parameter values: 17, 64.80, 8.00, 1.94, 74.74. As mentioned, these values represent the basket ID and the amounts for the subtotal, shipping, tax, and total.

5. Query the BB_BASKET table to confirm that the procedure was successful: SELECT subtotal, shipping, tax, total, orderplaced FROM bb_basket WHERE idbasket = 17; .

6. Create a procedure that returns the most recent order status information for a specified basket. This procedure should determine the most recent ordering-stage entry in the BB_BASKETSTATUS table and return the data. Use an IF or CASE clause to return a stage description instead of an IDSTAGE number, which means little to shoppers. The IDSTAGE column of the BB_BASKETSTATUS table identifies each stage as follows: -1-Submitted and received -2-Confirmed, processed, sent to shipping -3-Shipped -4-Cancelled -5-Back-ordered

The procedure should accept a basket ID number and return the most recent status description and date the status was recorded. If no status is available for the specified basket ID, return a message stating that no status is available. Name the procedure STATUS_SP. Test the procedure twice with the basket ID 4 and then 6.

7. Brewbean's wants to offer an incentive of free shipping to customers who haven't returned to the site since a specified date. Create a procedure named PROMO_SHIP_SP that determines who these customers are and then updates the BB_PROMOLIST table accordingly. The procedure uses the following information:

-Date cutoff-Any customers who haven't shopped on the site since this date should be included as incentive participants. Use the basket creation date to reflect shopper activity dates.

-Month-A three-character month (such as APR) should be added to the promotion table to indicate which month free shipping is effective.

-Year-A four-digit year indicates the year the promotion is effective. -promo_flag-1 represents free shipping.

The BB_PROMOLIST table also has a USED column, which contains the default value N and is updated to Y when the shopper uses the promotion. Test the procedure with the cutoff date 15-FEB-12. Assign free shipping for the month APR and the year 2012.

8. As a shopper selects products on the Brewbean's site, a procedure is needed to add a newly selected item to the current shopper's basket. Create a procedure named BASKET_ADD_SP that accepts a product ID, basket ID, price, quantity, size code option (1 or 2), and form code option (3 or 4) and uses this information to add a new item to the BB_BASKETITEM table. The table's PRIMARY KEY column is generated by BB_IDBASKETITEM_SEQ.

Run the procedure with the following values:
-Basket ID-14
-Product ID-8
-Price-10.80
-Quantity-1
-Size code-2
-Form code-4

Verified Expert

In this assignment the existing database of the online shopping is provided. They asked to write functions on the database to retrieve useful results from them.Functions to find the number of orders a shopper has placed, consumer shopping pattern is obtained, function to help quality analyst to determine the orders that took more than 1 day to deliver, displaying the status description of order, tax amount is calculated and function to display the sale information is written. All functions are written and executed in oracle and then output is documented with the coding

Reference no: EM131378872

Questions Cloud

Does dicintio have a cause of action under this law : When Adzan Auto Sales refused to terminate the lease or give him another car, DiContio brought suit against DaimlerChrysler for breach of the Magnuson-Moss Warranty Act. Does DiCintio have a cause of action under this law? Explain.
Discuss actions an administrator should review consistently : Discuss two to three actions an administrator should review consistently to alleviate over budgeting for operating and maintenance costs of a capital project.
What is the best way to study for an ap world history class : What is the best way to study for an AP World History class? The book that we have been assigned isn't easy on the eyes and dissuades many people from actually reading the book
Could they return the vehicle and recover damages : Two years later, after traveling more than 14,000 miles on trips to Louisiana, Colorado, and California, they attempted to reject the motor home, claiming that it was defective. Could they return the vehicle and recover damages? Explain.
Create a new basket containing two items : Create a procedure named BASKET_CONFIRM_SP that accepts the input values specified in the preceding description. Keep in mind that you're modifying an existing row of the BB_BASKET table in this procedure.
Did schleimer recover damages : Later, Googe changed his mind and refused to buy the car. Schleimer, without making tender of delivery, brought suit against Googe for breach of contract.
Identify the available search tools : Write a report reviewing the web site http://www.pt.rexnord.com. From a mechanical engineer's viewpoint interested in gear drives, discuss the content, usefulness, ease of use, and clarity of the site. Identify the available search tools.
How were youngs damages computed : Several months later, Frank's reduced its order to less than $60,000 for about 70 tons of boughs. Young delivered the 70 tons of boughs and sued Frank's for breach of contract. How were Young's damages computed?
What role did religion play in the ancient societies : What role did religion play in the ancient societies of Africa and the Americas and how did it impact politics, economics, culture, and social interactions

Reviews

inf1378872

2/4/2017 4:36:32 AM

Hi, Thank you such a great amount for your superb work on the paper. It truly helped me show signs of improvement thought of what to accomplish for mine. I will utilize Expertsmind again in the event that I require as well and will request you. Much appreciated once more!

inf1378872

2/4/2017 4:35:50 AM

unit4AssignmentDBprograming.docx Database is missing that is not attached, providing the same asap. oracle 11g. DAtabase attached database query 20852519_1c1 BBcreate.sql 20852519_2Chapter05.zip Here, I am again sending database. 20852514_1database.zip

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd