Calculating a shopper total number of orders

Assignment Help PL-SQL Programming
Reference no: EM131385054

Assignment 1: Calculating a Shopper's Total Number of Orders

Another commonly used statistic in reports is the total number of orders a shopper has placed. Follow these steps to create a function named NUM_PURCH_SF that accepts a shopper ID and returns a shopper's total number of orders. Use the function in a SELECT statement to display the number of orders for shopper 23. 1. Develop and run a CREATE FUNCTION statement to create the NUM_PURCH_SF function. The function code needs to tally the number of orders (using an Oracle built-in function) by shopper. Keep in mind that the ORDERPLACED column contains a 1 if an order has been placed. 2. Create a SELECT query by using the NUM_PURCH_SF function on the IDSHOPPER column of the BB_SHOPPER table. Be sure to select only shopper 23.

Assignment 2: Identifying the Weekday for an Order Date

 The day of the week that baskets are created is often analyzed to determine consumer shopping patterns. Create a function named DAY_ORD_SF that accepts an order date and returns the weekday. Use the function in a SELECT statement to display each basket ID and the weekday the order was created. Write a second SELECT statement, using this function to display the total number of orders for each weekday. (Hint: Call the TO_CHAR function to retrieve the weekday from a date.) 1. Develop and run a CREATE FUNCTION statement to create the DAY_ORD_SF function. Use the DTCREATED column of the BB_BASKET table as the date the basket is created. Call the TO_CHAR function with the DAY option to retrieve the weekday for a date value. 2. Create a SELECT statement that lists the basket ID and weekday for every basket. 3. Create a SELECT statement, using a GROUP BY clause to list the total number of baskets per weekday. Based on the results, what's the most popular shopping day?

Assignment 3: Calculating Days Between Ordering and Shipping

An analyst in the quality assurance office reviews the time elapsed between receiving an order and shipping the order. Any orders that haven't been shipped within a day of the order being placed are investigated. Create a function named ORD_SHIP_SF that calculates the number of days between the basket's creation date and the shipping date. The function should return a character string that states OK if the order was shipped within a day or CHECK if it wasn't. If the order hasn't shipped, return the string Not shipped. The IDSTAGE column of the BB_BASKETSTATUS table indicates a shipped item with the value 5, and the DTSTAGE column is the shipping date. The DTORDERED column of the BB_BASKET table is the order date. Review data in the BB_BASKETSTATUS table, and create an anonymous block to test all three outcomes the function should handle.

Assignment 4: Adding Descriptions for Order Status Codes

 When a shopper returns to the Web site to check an order's status, information from the BB_BASKETSTATUS table is displayed. However, only the status code is available in the BB_BASKETSTATUS table, not the status description. Create a function named STATUS_DESC_SF that accepts a stage ID and returns the status description. The descriptions for stage IDs are listed in Table 6-3. Test the function in a SELECT statement that retrieves all rows in the BB_BASKETSTATUS table for basket 4 and displays the stage ID and its description.

Assignment 5: Calculating an Order's Tax Amount

Create a function named TAX_CALC_SF that accepts a basket ID, calculates the tax amount by using the basket subtotal, and returns the correct tax amount for the order. The tax is determined by the shipping state, which is stored in the BB_BASKET table. The BB_TAX table contains the tax rate for states that require taxes on Internet purchases. If the state isn't listed in the tax table or no shipping state is assigned to the basket, a tax amount of zero should be applied to the order. Use the function in a SELECT statement that displays the shipping costs for a basket that has tax applied and a basket with no shipping state.

Assignment 6: Identifying Sale Products

When a product is placed on sale, Brewbean's records the sale's start and end dates in columns of the BB_PRODUCT table. A function is needed to provide sales information when a shopper selects an item. If a product is on sale, the function should return the value ON SALE!. However, if it isn't on sale, the function should return the value Great Deal!. These values are used on the product display page. Create a function named CK_SALE_SF that accepts a date and product ID as arguments, checks whether the date falls within the product's sale period, and returns the corresponding string value. Test the function with the product ID 6 and two dates: 10-JUN-12 and 19-JUN-12. Verify your results by reviewing the product sales information.

Verified Expert

Reference no: EM131385054

Questions Cloud

Why is the debt ratio useful as a business benchmark : What are the advantages and disadvantages of a high debt ratio?- Why is the debt ratio useful as a business benchmark?
Discuss about the post given below : Pick a process that you think you would like to use for your Personal Process Improvement Project and draw a SIPOC diagram of it. You will need this for your final project so construct it in a format that you will be able to easily import it into..
What steps would you take to protect your data personally : Now that you're learning about attacks and how to mitigate them, what recommendations would you have to your leadership at your company if this attack had happened on your watch? What steps would you take to protect your data personally?
Compute the percentages of assets in current assets : Compute the percentages of assets in current assets and fixed assets.- and The percentages of financing from (1) spontaneous financing and (2) internal equity.
Calculating a shopper total number of orders : Calculating a Shopper's Total Number of Orders Another commonly used statistic in reports is the total number of orders a shopper has placed. Follow these steps to create a function named NUM_PURCH_SF that accepts a shopper ID and returns a shopper..
Find out if the owner agrees with your conclusions : Acquire a small firm's financial statements. Review the statements and describe the firm's financial position. Find out if the owner agrees with your conclusions.
How will lynns worst case and best case projections affect : If all of C&G Products' other relationships hold, how will Lynn's worst-case and best-case projections affect the income statement and balance sheet in the first year?
Write an essay on the historic movie hidden figures : Write an essay on the historic movie Hidden Figures (which is currently playing in the movie theaters) explaining the main themes and historical reference in regards to this class. Make sure to critique the documentary in historical context and st..
Discuss the different types of german expansionism : Discuss why the different types of German expansionism in the Wilhelmine period helped force Germany and Europe down the path toward war in 1914.The Wilhelmine period was the era where William II became emperor of Germany. He became emperor becau..

Reviews

inf1385054

2/13/2017 5:10:55 AM

Very good work. Much obliged to you for rolling out the improvements after I ask for update from the expert! Thanks to you for the nature of client administration that you give.

inf1385054

2/13/2017 5:10:08 AM

Here I am attaching a database 20929582_1c6 BBcreate.sql Please find the attached file 20929523_1Chapter06.zip I need table description of status id it is in table 6-3. c6_BBcreate sql file

Write a Review

PL-SQL Programming Questions & Answers

  Create analyzelogs a node web app that will allow querying

In this assignment you will create analyzeLogs, a node web app that will allow querying and visualization of uploaded log files. Base your app on this template. You can use these files as test data. Your app, however, should work with other files ..

  Application which tests the random number generation

Write a Java application that inputs three integers from the user and displays the sum, average, product, smallest and largest of the numbers.

  Use the provided appbdbcreatesql sql script to create the

use the provided appbdbcreate.sql sql script to create the database to be used when working on this assignment.question

  Ilab sql queries using mysql

The purpose of this iLab is to prepare for the first phase of the Course Project. This week, you will learn to create and run SQL SELECT queries from a script  in the MySQL database. You will need to create a database in MySQL via Omnymbus, run a ..

  Assignment on tour operator agency database

Part 1: Design a data model that will conform to the following criteria: Question 1: a) Propose an efficient data structure that may hold the tour operator's data using a normalization process. Describe each step of the process that will enable yo..

  What does each allow or restrict

Roles and Profiles are used by Oracle to define and control access and privileges of groups of users. Compare and contrast the concepts of role and profile.

  Convert the er/eer model

To represent a problem description given in natural language as an (Enhanced) Entity -Relationship model; to convert the ER/EER model into a relational data model;

  Create a plsql block to achieve the following using the hr

create a plsql block to achieve the following using the hr schemaselect the name salary and department of the employee

  Sql queries for this assignment use the following database

for this assignment use the following database schema ltbrgt ltbrgt1 patientpatientid name dob ltbrgt ltbrgt2

  Meters of copper wire of cross-sectional diameter

A coil which is made by winding 500 meters of copper wire of cross-sectional diameter 1.26 mm has the same mass as another coil of copper wire whose cross-sectional diameter is 1.4 mm. Find the length of wire in the second coil.

  In this problem we will consider a movie database with

in this problem we will consider a movie database with three tablesmoviedirectortitle director yearmoviecasttitle actor

  Creating sql script queries

Get the movie title for all movies that are comedy or horror, rename the output attribute name to be "Happily Scared"

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