A pizza company is taking orders from customers, and each pizza ordered is added to their...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A pizza company is taking orders from customers, and each pizza ordered is added to their database as a separate order. Each order has an associated status, "CREATED or SUBMITTED or DELIVERED". An order's Final Status is calculated based on status as follows: 1. When all orders for a customer have a status of DELIVERED, that customer's order has a Final Status of COMPLETED. 2. If a customer has some orders that are not DELIVERED and some orders that are DELIVERED, the Final Status is IN PROGRESS. 3. If all of a customer's orders are SUBMITTED, the Final Status is AWAITING PROGRESS. 4. Otherwise, the Final Status is AWAITING SUBMISSION. Write a query to report the customer_name and Final Status of each customer's order. Order the results by customer name. Table definitions and a data sample are given below. Schema Table: Customer_Order column name column type customer_name varchar2(50) order_id varchar2(10) status varchar2(50) Sample Data Tables Table: Customer_Order Customer_name order_id status John J1 DELIVERED John J2 DELIVERED David D1 SUBMITTED David D3 CREATED Smith S1 SUBMITTED KRISH K1 CREATED When all orders are in DELIVERED status then the Final Status is "COMPLETED". When one or more orders for a customer are DELIVERED and one or more orders are CREATED or SUBMITTED, then the Final Status is "IN PROGRESS". When one or more orders for a customer are SUBMITTED and none are DELIVERED, then the Final Status is "AWAITING PROGRESS". Otherwise, the Final Status is "AWAITING SUBMISSION". Order priority is DELIVERED, SUBMITTED, CREATED. The results are: customer_name Final Status David IN PROGRESS John COMPLETED KRISH AWAITING SUBMISSION Smith AWAITING PROGRESS A pizza company is taking orders from customers, and each pizza ordered is added to their database as a separate order. Each order has an associated status, "CREATED or SUBMITTED or DELIVERED". An order's Final Status is calculated based on status as follows: 1. When all orders for a customer have a status of DELIVERED, that customer's order has a Final Status of COMPLETED. 2. If a customer has some orders that are not DELIVERED and some orders that are DELIVERED, the Final Status is IN PROGRESS. 3. If all of a customer's orders are SUBMITTED, the Final Status is AWAITING PROGRESS. 4. Otherwise, the Final Status is AWAITING SUBMISSION. Write a query to report the customer_name and Final Status of each customer's order. Order the results by customer name. Table definitions and a data sample are given below. Schema Table: Customer_Order column name column type customer_name varchar2(50) order_id varchar2(10) status varchar2(50) Sample Data Tables Table: Customer_Order Customer_name order_id status John J1 DELIVERED John J2 DELIVERED David D1 SUBMITTED David D3 CREATED Smith S1 SUBMITTED KRISH K1 CREATED When all orders are in DELIVERED status then the Final Status is "COMPLETED". When one or more orders for a customer are DELIVERED and one or more orders are CREATED or SUBMITTED, then the Final Status is "IN PROGRESS". When one or more orders for a customer are SUBMITTED and none are DELIVERED, then the Final Status is "AWAITING PROGRESS". Otherwise, the Final Status is "AWAITING SUBMISSION". Order priority is DELIVERED, SUBMITTED, CREATED. The results are: customer_name Final Status David IN PROGRESS John COMPLETED KRISH AWAITING SUBMISSION Smith AWAITING PROGRESS
Expert Answer:
Answer rating: 100% (QA)
Below I have added the SQL query which uses case statements to provide solution for above problem st... View the full answer
Related Book For
Auditing A Practical Approach with Data Analytics
ISBN: 978-1119401742
1st edition
Authors: Raymond N. Johnson, Laura Davis Wiley, Robyn Moroney, Fiona Campbell, Jane Hamilton
Posted Date:
Students also viewed these accounting questions
-
A pizza delivery company promises to deliver all customer orders within one hour of receiving an order at one of its stores. Actual data for all pizza delivered during the past week showed that the...
-
An aerospace company has submitted bids on two separate federal government defense contracts. The company president believes that there is a 40% probability of winning the first contract. If they win...
-
A mail- order company has one department for taking customer orders and another for handling com-plaints. Currently, each department has a separate telephone number. Each has 7 telephone lines served...
-
Accounting for Contingencies and Provisions In accounting, contingencies and provisions play a crucial role in preparing financial statements and ensuring accurate representation of a company's...
-
Explain the accounting rules applicable to accounts in the expenditure and acquisitions process including: a. Liability b. Expense
-
Riley (mass 71 kg) glides at 2.1 m/s to a stationary Holland (52 kg) and hangs on. How far will they slide after the "collision" if the coefficient of kinetic friction between the skates and ice is...
-
Why is it important to have an adaptable workforce in a global economy?
-
Carlos Corporations Morgan Plant in Jacksonville, Florida, produces the companys weed-control chemical solution, Weed Terminator. Production begins with pure water from a controlled stream to which...
-
Recall Neville's algorithm: - Pi,i = y; $2pt]pij= (xx)Pi+1(x) (x-xj)Pij-1(x) Write a Python function that implements this algorithm. The function should have three inputs: a list i, a list yi, and a...
-
Isorait Co is a company which installs kitchens and bathrooms to customer specifications. It is planning to invest KShs. 4,000,000 in a new facility to convert vans and trucks into motorhomes. Each...
-
Sapura Energy Berhad is a public company trading in the oil and gas industry. Recently the company has applied for debt restructuring to try and manage its financial situation. What are the legal...
-
How do emerging technologies such as machine learning and artificial intelligence facilitate predictive modeling and early detection of potential process safety incidents? Explain
-
On January 1 , 2 0 1 3 , Lindsay Owens opened Picture Perfect, a small retail store that sells picture frames, crafts & art. On June 3 0 , 2 0 1 4 , her accounting records show the following: Store...
-
A corporation is trying to determine if it is exempt from the personal holding company tax. Which code section and subsection indicates what types of entities are not considered personal holding...
-
How do inherent safety principles influence the design and operation of chemical processes to mitigate potential hazards ?
-
Product Omega has revenue of $ 1 9 4 , 5 0 0 , variable cost of goods sold of $ 1 1 5 , 7 0 0 , variable selling expenses of $ 3 2 , 5 0 0 , and fixed costs of $ 6 1 , 8 0 0 , creating an operating...
-
Employeeld OfficeNumber EM32221 EM32222 EM32222 EM32221 OF004 OF003 OF004 OF003 Office Address 123 Glades Rd, Boca Raton, FL 456 University Rd, Davie, FL 123 Glades Rd, Boca Raton, FL 456 University...
-
An annual report of The Campbell Soup Company reported on its income statement $2.4 million as equity in earnings of affiliates. Journalize the entry that Campbell would have made to record this...
-
If an auditor identifies an internal control weakness for an assertion, how does it affect the audit strategy? If the auditor identifies an internal control strength for an assertion, how does it...
-
The key documents involved in recording a purchase adjustment involve: a. A purchase return authorization, a shipping report, and a debit memo. b. A vendors invoice, a receiving report, and a credit...
-
Auditors of publicly traded companies are required to perform a(an) ________ for their clients. a. Compliance audit b. Integrated audit c. Internal audit d. Operational audit
-
Test the overall significance of a regression model and identify the components of this test from your computer output.
-
Identify the sample.
-
Based on the strategy, what type of sampling technique will be used to identify the sample? a. Why did you choose this type of technique?
Study smarter with the SolutionInn App