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

  Difference between data block-extent-segment and tablespace

Allocation in Oracle can aid recognize problems more easily. In your own words, give the description of difference between data block, extent, a segment, and a tablespace.

  Computing a mathematical discipline a scientific discipline

Name the four areas in which a practitioner in computer science must be skilled.2) Is computing a mathematical discipline, a scientific discipline, or an engineering discipline? Explain in 50 words or less.

  Application screen design and layout function

Design focus is on providing the application screen design and layout function for the purchaser. You do not have to worry about the accounting system for the bookshop

  Optimizes processing large amounts of data

Businesses today are extremely reliant on large amounts of data for making intelligent business decisions. Likewise, the data warehouses are often structured in a manner that optimizes processing large amounts of data.

  In three sentences describe games you play on your computer

In three sentences describe some of the games you play on your computer. Explain when and why you play the games. (2) If you do not play games, describe the other things you do on your computer

  Examine the challenges associated with searching in textual

Your company has been hired to design a product that will provide searches of textual documents and database querying. Your design team has not developed a product like this before. Examine the challenges associated with searching in textual docum..

  Required to develop software that uses

You are required to develop software that uses the uC/OS-II operating system to implement a security briefcase alarm on a LPC-2378STK ARM board. Your software should be written in standard C and should run on an ARM board in PB S2. You should ima..

  What makes a good proposal

Persuade the reader that the proposers (you) are qualified for the work, have a plausible plan and have the resources needed to complete the task.

  Base on museum and art shows in a museum

BASE ON MUSEUM and art shows in a MUSEUM Design and develop the below queries using professional principles and standards: A set of SQL Statements that returns all rows and all data for each table in your database.

  Create a data file in the specified format

Create a data file in the specified format. Write a script that would read from the file floatnums.dat into a matrix, round the numbers, and write the matrix in the desired format to a new file called "intnums.dat."

  Explaining smartphones as important digital devices

Many resources will suggest that in the next few coming years, smartphones will become the one of the most important digital devices we own. Explain the implications of this statement.

  Better job of allowing computers to network

You wrote a piece of software that does a better job of allowing computers to network than any other program designed for this purpose.

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