25.08.2015 Views

CIS 336 Week 6 iLab 6 Devry University/ SNAPTUTORIAL

For more classes visit www.snaptutorial.com Week 6. L A B S T E P S STEP 1: Back to top Using the BOOK_CUSTOMER table and the NVL 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 another customer. Give the derived column an alias of REFERRED BY. Do not list any customers that were referred by another customer. STEP 2: Back to top Using the BOOKS table and the SUBSTR function, create a query that will return a list of book ISBN codes and the book title for all the computer books. Format the ISBN code to display as 9-999-99999-9 (e.g., 1059831198 would display as 1-059-83119-8) STEP 3: Back to top Using the BOOKS table, create a query using the correct functions to return the category name, the total retail of all books per category with a column alias of "Total Retail", and the average retail of all the books per category with an alias of "Average Retail" for all categories

For more classes visit
www.snaptutorial.com
Week 6. L A B S T E P S STEP 1: Back to top Using the BOOK_CUSTOMER table and the NVL 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 another customer. Give the derived column an alias of REFERRED BY. Do not list any customers that were referred by another customer. STEP 2: Back to top Using the BOOKS table and the SUBSTR function, create a query that will return a list of book ISBN codes and the book title for all the computer books. Format the ISBN code to display as 9-999-99999-9 (e.g., 1059831198 would display as 1-059-83119-8) STEP 3: Back to top Using the BOOKS table, create a query using the correct functions to return the category name, the total retail of all books per category with a column alias of "Total Retail", and the average retail of all the books per category with an alias of "Average Retail" for all categories

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>CIS</strong> <strong>336</strong> <strong>Week</strong> 6 <strong>iLab</strong> 6 <strong>Devry</strong> <strong>University</strong>To Purchase This Material Click below Linkhttp://www.snaptutorial.com/<strong>CIS</strong>-<strong>336</strong>-(<strong>Devry</strong>)/<strong>CIS</strong>-<strong>336</strong>-<strong>Week</strong>-6-<strong>iLab</strong>-6-<strong>Devry</strong>-<strong>University</strong>-For more classes visitwww.snaptutorial.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, firstname, last name, and the characters ‘NOT REFERRED’ if the customer was not referred byanother customer. Give the derived column an alias of REFERRED BY. Do not list anycustomers that were referred by another customer. STEP 2: Back to top Using the BOOKStable and the SUBSTR function, create a query that will return a list of book ISBN codes andthe book title for all the computer books. Format the ISBN code to display as 9-999-99999-9(e.g., 1059831198 would display as 1-059-83119-8) STEP 3: Back to top Using the BOOKStable, create a query using the correct functions to return the category name, the total retail ofall books per category with a column alias of "Total Retail", and the average retail of all the


ooks per category with an alias of "Average Retail" for all categories with a total retailgreater than $40.00. Format the total retail and average retail columns using the correctfunction to show dollars and cents with a dollar sign. STEP 4: Back to top Using the correcttables in your schema, create a query using either join operation you wish that will list thebook title and number of authors for all books that have been written by more than one author.Give the title column an alias of "Book Title" and the column showing the number of authorsan alias of "Number of Authors". STEP 5: Back to top Using the BOOK_AUTHOR andAUTHOR tables for the upper most query, create a sub query that will return the BOOKID,and the first and last name of the author(s) who have written the book(s) that have beenpurchased the most. To successfully accomplish this, you will need to first find out themaximum total number of copies (based on quantity) sold of a book (based on bookid) in theORDER_ITEMS table. This will be done in the bottom most query. The return from thisquery will be used to compare against the BOOKID in the ORDER_ITEMS table that occursan equal number of times in the middle query. The return of this query will then be used tocompare 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:Back to top Using the correct tables, create a sub query using either join operation you wishthat will list the customer number, first and last name concatenated together, and city for allcustomers who have placed an order for the most expensive book (based on retail price). Givethe combined customer names column and alias of "Customer Name". STEP 7: Back to topUsing the ORDER_ITEMS table, create a query using the correct functions to return theitem#, the total quantity of items ordered with an alias of "Total", the average quantity perorder with an alias of "Average" (since averages are often in decimals, only show twodecimal places), the minimum quantity ordered with an alias of "Minimum", and themaximum quantity ordered with an alias of "Maximum". Your output results set should havefive columns and four rows of data. STEP 8: Back to top Using the BOOKS table, create aquery using the DECODE function that will display the book title, the published date, and thepublisher name (this is where the decode function comes in). Give the publisher namecolumn an alias of "Publisher Name", and order the publisher names in descending order. Thepublisher names used should be the same as those in the PUBLISHER table. DO NOT join tothe Publisher table for this query. STEP 9: Back to top Using the PUBLISHER table, create aquery that will return a line of output like the one below for each record in the table. Be sureto use the correct functions in the SELECT statement, so that your output looks like theexample below. The contact person for Printing Is Us Publishing is Tommie Seymour. Besure to use the correct function to display the publisher name and publisher contact with onlythe first letter of each word capitalized. STEP 10: Back to top Using the correct tables, createa query using the JOIN ON method to display a listing of all customers who have purchasedmore than two books. List the customer’s last name, the customer’s city and state, and thenumber of books they have purchased. Give the number purchased column and alias of"Number Purchased". STEP 11: Back to top Using only the BOOK table for the upper moststatement, 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 aROLLBACK statement to return the data to the original state. STEP 12: Back to top Usingthe BOOK_CUSTOMER table, write a sub query that will return the names of thosecustomers who were referred by the same individual who referred Jorge Perez. Do notdisplay Jorge Perez’s name in the returned results (Hint: you should only have two customersdisplayed and the exclusion for Jorge Perez must be associated with the upper query). STEP


13: Back to top Using the BOOKS table, create a query using the correct functions to returnthe category name, total number books per category with a column alias of "Category Total",and the total cost of all the books per category with an alias of "Cost". Format the costcolumn using the correct function to show dollars and cents with a dollar sign. This is the endof Lab #6 Back to top]HTML

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

Saved successfully!

Ooh no, something went wrong!