Discount Get ALL WEEKS Solution ONLY $0.00
CIS 336 Week 1 - Lab 1 - an Original and A++ work [$8.99]
CIS 336 Week 2 - Lab 2 - an Original and A++ work [$8.99]
CIS 336 Week 3 - Lab 3 - an Original and A++ work [$8.99]
CIS 336 Week 4 - Lab 4 - an Original and A++ work [$9.99]
CIS 336 Week 5 - Lab 5 - an Original and A++ work [$9.99]
CIS 336 Week 6 - Lab 6 - an Original and A++ work [$9.99]
CIS 336 Week 7 - Lab 7 - an Original and A++ work [$8.99]
CIS 336 Final Exam - All Quizzes [$9.99]
Get Selected Weeks Solution with ONLY NOT Add Selected Tutorials To Cart
CIS336, CIS 336, CIS 336 Week 6, CIS 336 Lab 6, CIS336 iLab 6 - an Original and A++ Solution !!!
    CIS336, CIS 336, CIS 336 Week 6, CIS 336 Lab 6, CIS336 iLab 6 - an Original and A++ Solution !!!

CIS336, CIS 336, CIS 336 Week 6, CIS 336 Lab 6, CIS336 iLab 6 - an Original and A++ Solution !!!

$9.99

iLab 6 of 7: Oracle Single Row and Group Functions (28 points)
Submit your assignment to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, please click here.
(See Syllabus/”Due Dates for Assignments & Exams” for due dates.)

L A B O V E R V I E W
Scenario/Summary

Lab #6 will introduce the various aspects of the Single-Row and Group Functions available in the Oracle Database. Most functions can be used in either the SELECT statement or the WHERE clause, but more commonly are used in the SELECT. Chapters 5 and 6 cover most all of the normal processing you use in these functions. In some cases, you will be asked to used more than one function within a single SELECT statement.
General Lab Information and Considerations
This lab will utilize the same set of tables found in the script file (LeeBooks.SQL) that were used for Labs 4 and 5.
Each query in the script file you will create must be numbered (use –1 comments for numbering) and in order. The SQL for the following exercises should be written using notepad and run in SQL*Plus. Read each problem carefully and follow the directions as stated.
A Clean Script File:
A script file is meant to be like a program. The file can be run every time the code needs to be executed without having to retype the code again each time. For this reason, it is important that there are no errors in the code inside the file. You can go back and forth between notepad and Oracle when creating your script file to check your queries and verify if they work or not. However, you do not want to create your final output file until after you have verified that everything in your script is correct by running it, in its entirety at least once and viewing the output. Once this has been done, you can create your final output file, with echo to create the document, you can turn in with your lab. Remember in using a spool session, you must type “SPOOL OFF” at the SQL> prompt after your script stops spooling to capture all of your data!
Lab Do’s and Don’t’s
• Do Not include the LEEBOOKS.SQL as part of your lab script.
o Do use Notepad to write your query script file.
• Do Not write your queries in Word.
o Do test each query before moving on to the next.
• Do Not include extra queries for a problem unless the problem explicitly asks for more than one query.
o Do test your queries before creating your final output file.
• Do Not turn in a script file that has queries with errors.
o Do number each query using – -1 comment notation.
• Do Not start your query on the same line as the comment.
o Do remember to check your final output and script file for accuracy.
• Do Not turn in your lab without first checking your output file to verify that it is correct.
Things to keep in mind:
If you are not sure of the table names in your user schema, you can use the following select statement to list them.
SELECT * FROM TAB;
If you want to know the name of the columns in a particular table you can use the following command to list them.
DESC
Making a script file containing a series of describe statements for each table and then spooling the output will give you a listing of all the tables with column names.
Be sure to review and verify your final output when you are finished. Do Not assume anything.
Write queries for each of the stated problems in the steps below that will return a result set of data to satisfy the requirements. When finished, your script file should have a total of 13 queries, and your resulting output file should show both the query and result set for each.
Deliverables
Submit for grading:
1. Your script file with the 13 queries in it. Be sure your name, course number, and lab number are in a comment area at the top of your file.
2. An output file created using SET ECHO ON showing both the SQL code and the results.
3. Both documents are to be zipped into a single file before submitting to the iLab Dropbox for Week 6.
L A B S T E P S
STEP 1:

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:

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:

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 with a total retail greater than $40.00. Format the total retail and average retail columns using the correct function to show dollars and cents with a dollar sign.
STEP 4:

Using the correct tables in your schema, create a query using either join operation you wish that will list the book 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 authors an alias of “Number of Authors”.
STEP 5:

Using the BOOK_AUTHOR and AUTHOR 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 been purchased the most. To successfully accomplish this, you will need to first find out the maximum total number of copies (based on quantity) sold of a book (based on bookid) in the ORDER_ITEMS table. This will be done in the bottom most query. The return from this query will be used to compare against the BOOKID in the ORDER_ITEMS table that occurs an equal number of times in the middle query. The return of this query will then be used to compare to a BOOKID related to an Author in the tables of the top most query. (HINT: Be careful, you will need both GROUP BY and HAVING clauses for your solution.)
STEP 6:

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 customers who have placed an order for the most expensive book (based on retail price). Give the combined customer names column and alias of “Customer Name”.
STEP 7:

Using the ORDER_ITEMS table, create a query using the correct functions to return the item#, the total quantity 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 minimum quantity 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:

Using the BOOKS table, create a query using the DECODE function that will display the book title, the published date, and the publisher name (this is where the decode function comes in). Give the publisher name column an alias of “Publisher Name”, and order the publisher names in descending order. The publisher names used should be the same as those in the PUBLISHER table. DO NOT join to the Publisher table for this query.
STEP 9:

Using the PUBLISHER table, create a query that will return a line of output like the one below for each record in the table. Be sure to use the correct functions in the SELECT statement, so that your output looks like the example below.
The contact person for Printing Is Us Publishing is Tommie Seymour.
Be sure to use the correct function to display the publisher name and publisher contact with only the first letter of each word capitalized.
STEP 10:

Using the correct tables, create a query using the JOIN ON method to display a listing of all customers who have purchased more than two books. List the customer’s last name, the customer’s city and state, and the number of books they have purchased. Give the number purchased column and alias of “Number Purchased”.
STEP 11:

Using only the BOOK table for the upper most statement, create a sub query that will update the retail price of all books published by PRINTING 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 select statement on the BOOKS table before your update statement, and then a second select on the BOOKS table after the update. Once you have verified the results, you can issue a ROLLBACK statement to return the data to the original state.
STEP 12:

Using the BOOK_CUSTOMER table, write a sub query that will return the names of those customers who were referred by the same individual who referred Jorge Perez. Do not display Jorge Perez’s name in the returned results (Hint: you should only have two customers displayed and the exclusion for Jorge Perez must be associated with the upper query).
STEP 13:

Using the BOOKS table, create a query using the correct functions to return the 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 cost column using the correct function to show dollars and cents with a dollar sign.
This is the end of Lab #6

Solution for CIS336 Lab 6

It is 100% correct solution.

If you have more questions, please contact me via email support@extutorials.com, i will help you any time.

Thank you !

Attached Files

Move over [ preview ] file name to preview content in it!

  • CIS336_Week6_iLab6.zip [221.6KB]
    • Output_Lab6.txt [71.6KB] [ preview ]
    • Screenshot_CIS336_Lab6_spoolfile.jpg [146.6KB]
    • YourName_Lab6.txt [3.3KB] [ preview ]

Write a review

Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below:



PURCHASE SAVE
2 Tutorials 10%
3 Tutorials 13%
4 Tutorials 16%
5 Tutorials 19%
6 Tutorials 22%
7 Tutorials 25%
8 Tutorials 28%
9 Tutorials 31%
10 Tutorials 34%
add url more

9MZQASHWN73B