Id and the average length of time elapsed

Assignment Help Basic Computer Science
Reference no: EM13936810

Write SQL queries that meet the following specifications. Do not show output. All questions are worth three marks.

a) Display the order number and customer number for all orders. Sort by order number within customer number.
b) Display full details for all rows where the shipping street contains the string MAIN.
c) Display the title for each book and the profit margin for that book (profit = retail - cost). Your query should produce output in the following format. The book <title> earned a profit of <profit>, for example: The book Easy SQL earned a profit of $30.
d) Display full details for all books that cost less than thirty dollars and are in the FITNESS category OR cost more than thirty dollars and are in the SELF HELP category.
e) Display the customer id and the average length of time elapsed between an order being placed and the actual shipment of that order (shipment time) for all orders placed by that customer. Display the average length of time in months rounded to the nearest month.
f) Display complete details for the order/s with the earliest shipdate.
g) Using a set operator, display the customer number for all customers who placed an order during March, 2002 and who were referred by another customer. The column called referred may contain null values.
h) For each order item, display the order#, customer last name, item# and quantity.
i) Using a set operator, display the order number for all orders that have no items.

j) Display the order number and total quantity ordered for all orders that have a total quantity greater than 120.

Question 2

Write ONE PL/SQL program (anonymous block) that provides a report of all books published by specific publishers that have sold more than one thousand copies. The report should insert into an existing table the publisher name and the total number of copies of all books sold for that publisher (subject to specific business rules). The detailed specification is as follows:

· Using an explicit cursor, retrieve all books from the books table that were published by publishers 2, 6 or 7.
· Books with a retail price greater than $1 should be selected for further processing. This operation must be done using the IF statement.
· Using a second explicit cursor (with appropriate parameters), count the number of copies that the book has sold. Store the total count in a local variable named BOOKCOUNT and the total count of all books for a particular publisher in PUBCOUNT.
· If the book has sold one thousand or less copies, move to the next book. If no book has sold one thousand or more copies, exit the program and display the following message: There are no high sales books for these publishers.
· If a book has sold one thousand copies or more, retrieve details about the publisher. Use an explicit cursor.
· Into a table named HIGHCOUNT, insert the publisher name and the total count of all books sold for that publisher. This table has three columns as follows: publisher name, pubcount and rundate.
· Create an exception handler which fires when no rows are found. The exception handler should output the following message to the screen: No rows found.

Reference no: EM13936810

Questions Cloud

Book summary - the dead do not improve : Please write a summary of BOOK ONE (pg 1-60) of "The Dead Do Not Improve" by Jay Caspian Kang
Is noailles being unfairly penalised if she implements jit : Is Noailles being unfairly penalised if she implements JIT? What should Noailles do? What should Eluard do? Is Noailles correct in characterising some of the financial benefits as 'soft'?
Including the column names, datatypes : Please submit the CODE and OUTPUT for all programming questions. You will submit this assignment electronically in the ASSESSMENT area of the Study Desk.
Conduct research into identifying international markets : Why is it important to conduct research into identifying international markets?
Id and the average length of time elapsed : Display the order number and customer number for all orders. Sort by order number within customer number.b) Display full details for all rows where the shipping street contains the string MAIN.
Write essay about market research : Hi, i need to write essay about Market Research. However, for the analysis i need to consider the information about Antony's Orchard Company
How are nurse practitioners utilized in your community : Discuss the following with regard to the role and responsibilities of a nurse in a community: How are nurse practitioners utilized in your community? Do they increase access to health care or work for physicians
Implement international marketing activities : Prioritise marketing activities and obtain resources for their implementation
Imagine a circular linked list of integers and explain it : imagine a circular linked list of integers that are sorted into ascending order as shown in the attached file. The external pointer list points to the last node, which contains the largest integer.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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