17.08.2015 Views

CIS 336 Week 6 iLab 6 Devry University/uophelp

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>CIS</strong> <strong>336</strong> <strong>Week</strong> 6 <strong>iLab</strong> 6 <strong>Devry</strong> <strong>University</strong> (<strong>Devry</strong>)Click Here To Buy The Tutorialhttp://www.<strong>uophelp</strong>.com/<strong>CIS</strong>-<strong>336</strong>-(<strong>Devry</strong>)/product-9119-<strong>CIS</strong>-<strong>336</strong>-<strong>Week</strong>-6-<strong>iLab</strong>-6-<strong>Devry</strong>-<strong>University</strong>-(<strong>Devry</strong>)For more course tutorials visitwww.<strong>uophelp</strong>.com<strong>Week</strong> 6. L A B S T E P S STEP 1: Back to top Using the BOOK_CUSTOMER table and theNVL function, create a query that will return a list containing the customer number, first name,last name, and the characters ‘NOT REFERRED’ if the customer was not referred by anothercustomer. Give the derived column an alias of REFERRED BY. Do not list any customers thatwere referred by another customer. STEP 2: Back to top using the BOOKS table and theSUBSTR function, create a query that will return a list of book ISBN codes and the book title forall the computer books. Format the ISBN code to display as 9-999-99999-9 (e.g., 1059831198would display as 1-059-83119-8) STEP 3: Back to top Using the BOOKS table, create a queryusing the correct functions to return the category name, the total retail of all books per categorywith a column alias of "Total Retail", and the average retail of all the books per category with analias of "Average Retail" for all categories with a total retail greater than $40.00. Format the totalretail and average retail columns using the correct function to show dollars and cents with adollar sign. STEP 4: Back to top using the correct tables in your schema, create a query usingeither join operation you wish that will list the book title and number of authors for all books thathave been written by more than one author. Give the title column an alias of "Book Title" and thecolumn showing the number of authors an alias of "Number of Authors". STEP 5: Back to topusing the BOOK_AUTHOR and AUTHOR tables for the upper most queries, create a sub querythat will return the BOOKID, and the first and last name of the author(s) who have written thebook(s) that have been purchased the most. To successfully accomplish this, you will need tofirst find out the maximum total number of copies (based on quantity) sold of a book (based onbook id) in the ORDER_ITEMS table. This will be done in the bottom most queries. The returnfrom this query will be used to compare against the BOOKID in the ORDER_ITEMS table thatoccurs an equal number of times in the middle query. The return of this query will then be usedto compare to a BOOKID related to an Author in the tables of the top most query. (HINT: Becareful, you will need both GROUP BY and HAVING clauses for your solution.) STEP 6: Backto top Using the correct tables, create a sub query using either join operation you wish that will


list the customer number, first and last name concatenated together, and city for all customerswho have placed an order for the most expensive book (based on retail price). Give the combinedcustomer names column and alias of "Customer Name". STEP 7: Back to top Using theORDER_ITEMS table, create a query using the correct functions to return the item#, the totalquantity of items ordered with an alias of "Total", the average quantity per order with an alias of"Average" (since averages are often in decimals, only show two decimal places), the minimumquantity ordered with an alias of "Minimum", and the maximum quantity ordered with an alias of"Maximum". Your output results set should have five columns and four rows of data. STEP 8:Back to top Using the BOOKS table, create a query using the DECODE function that willdisplay the book title, the published date, and the publisher name (this is where the decodefunction comes in). Give the publisher name column an alias of "Publisher Name", and order thepublisher names in descending order. The publisher names used should be the same as those inthe PUBLISHER table. DO NOT join to the Publisher table for this query. STEP 9: Back to topUsing the PUBLISHER table, create a query that will return a line of output like the one belowfor each record in the table. Be sure to use the correct functions in the SELECT statement, so thatyour output looks like the example below. The contact person for Printing Is Us Publishing isTommie Seymour. Be sure to use the correct function to display the publisher name andpublisher contact with only the first letter of each word capitalized. STEP 10: Back to top Usingthe correct tables, create a query using the JOIN ON method to display a listing of all customerswho have purchased more than two books. List the customer’s last name, the customer’s city andstate, and the number of books they have purchased. Give the number purchased column andalias of "Number Purchased". STEP 11: Back to top Using only the BOOK table for the uppermost statement, create a sub query that will update the retail price of all books published byPRINTING IS US by five percent (retail * 1.05). Remember, all you have is the publisher"name". Use the sub query to find the publisher ID. To verify your update, provide a selectstatement on the BOOKS table before your update statement, and then a second select on theBOOKS table after the update. Once you have verified the results, you can issue a ROLLBACKstatement to return the data to the original state. STEP 12: Back to top using theBOOK_CUSTOMER table, write a sub query that will return the names of those customers whowere referred by the same individual who referred Jorge Perez. Do not display Jorge Perez’sname in the returned results (Hint: you should only have two customers displayed and theexclusion for Jorge Perez must be associated with the upper query). STEP 13: Back to top usingthe BOOKS table, create a query using the correct functions to return the category name, totalnumber books per category with a column alias of "Category Total", and the total cost of all thebooks per category with an alias of "Cost". Format the cost column using the correct function toshow dollars and cents with a dollar sign. This is the end of Lab #6 Back to top] HTML

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!