Cis 336 week 4 ilab 4 devry university (devry)

Page 1

CIS 336 Week 4 iLab 4 Devry University (Devry) Click Here to Purchase the Tutorial http://www.shoptutorial.com/shop/university/devry-courses/cis-336/cis-336week-4-ilab-4-devry-university-devry/

For more course tutorials visit www.shoptutorial.com Product Description Lab 4 of 7: Building the Physical Model (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 #4 will introduce the various aspects of the SQL select statement and the methods of retrieving data from the database tables. The lab will utilize a set of tables found in the script file (LeeBooks.sql) found in the Doc Sharing area of the website. You will need to download the file, then run the script in your SQL*Plus session. These tables will be used for the remaining labs in this class. The SELECT statement is the primary means of extracting data from database tables, and allows you to determine exactly which data you want to extract by means of different comparison operators used in the WHERE clause. This includes the use of specific "wild card" characters which allow you to search for character or number patterns within the data. You can also perform mathematical expressions within the SELECT statement to create derived output. The ORDER BY clause allows you to sort the output data in either ascending (the default) or descending order. Lab #4 will explore all of these applications of the SELECT statement. General Lab Information and Considerations Each query in the script file you will create must be numbered (use - -1 comments for numbering) and listed 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, but 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 on 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. Do use Notepad to write your query script file. Do Not write your queries in Word. 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. Do test your queries before creating your final output file. Do Not turn in a script file that has queries with errors. Do number each query using - -1 comment notation. Do Not start your query on the same line as the comment. 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 The deliverable for this lab will include: 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. An output file created using SET ECHO ON showing both the SQL code and the results. Both documents are to be zipped into a single file before submitting to the iLabDropbox for Week 4. L A B S T E P S STEP 1: Using the BOOKS table, write a query that will list the categories for the books in inventory. List each category only once in your result set. STEP 2: Using the BOOKS table, write a query that will list the title and publisher ID for each book in the table. Use the column heading of "Publisher ID" for the pubid field. STEP 3: Using the BOOKS table, write a query that will list the book title, retail price, and the amount of markup for each book. The amount of markup is the retail price minus the cost. Use the column heading “Price Markup” for the arithmetic expression column. STEP 4: Using the BOOK_CUSTOMER table, write a query that will list the customer’s first name, last name, and city for those customers living in zip code 31206. STEP 5: Using the BOOK_ORDER table, write a query that will list everything about the orders placed prior to April 2, 2009. STEP 6: Using the BOOK_ORDER table, write a query that will list everything about the orders that have not been shipped yet. STEP 7: Using the BOOK_CUSTOMER table, write a query using the AND and OR operators that will list the customer information for those customers living in either Florida or New Jersey who have not been referred by another customer. STEP 8: Using the BOOKS table, write a query that will list all information about those books that are not computer books and do not cost more than $30.00 retail. STEP 9: Using the AUTHOR table, write a query that will list all information about authors whose first name ends with an “A”. Put the results in descending order of last name, and then ascending order by first name. This should be done using a single query. STEP 10: Using the BOOK_ORDER table, write a query using the > and < operators="" that="" will="" list="" the="" orders="" that="" were="" placed="" between="" april="" 1,="" 2009="" and="" april="" 4,="" 2009.="" only="" show="" the="" orders="" for="" april="" 2nd="" and="" 3rd="" in="" your="" result="" set.="" step="" 11:="" using="" the="" book_order="" table,="" write="" a="" query="" that="" will="" list="" the="" orders="" that="" were="" placed="" between="" april="" 2,="" 2009="" and="" april="" 4,="" 2009="" including="" those="" placed="" on="" the="" 2nd="" and="" 4th.="" use="" a="" different="" approach="" (operator)="" in="" writing="" this="" query="" than="" used="" in="" the="" query="" for="" #10,="" that="" is,="" do="" not="" use=""> and < signs="" in="" your="" query.="" step="" 12:="" using="" the="" books="" table,="" write="" a="" query="" that="" will="" list="" the="" book="" title,="" publisher="" id,="" and="" published="" date="" for="" all="" books="" that="" were="" published="" by="" publisher="" 4="" or="" after="" january="" 1,="" 2001.="" order="" the="" results="" in="" ascending="" order="" by="" publisher="" id="" and="" give="" the="" publish="" date="" and="" publisher="" id="" columns="" meaningful=""


titles.="" step="" 13:="" many="" organizations="" use="" percentage="" of="" markup="" (e.g.,="" profit="" margin)="" when="" analyzing="" financial="" data.="" to="" determine="" the="" percentage="" of="" markup="" for="" a="" particular="" item,="" simply="" subtract="" the="" cost="" for="" the="" item="" from="" the="" retail="" price="" to="" obtain="" the="" dollar="" amount="" of="" profit,="" and="" then="" divide="" the="" profit="" by="" the="" cost="" of="" the="" item.="" the="" resulting="" solution="" is="" then="" multiplied="" by="" 100="" to="" determine="" the="" percent="" of="" markup.="" using="" a="" select="" statement,="" display="" the="" title="" of="" each="" book="" and="" its="" percent="" of="" markup.="" for="" the="" column="" displaying="" the="" percent="" of="" markup,="" use="" “markup="" %�="" as="" the="" column="" heading.="" this="" is="" the="" end="" of="" lab="" #4="">


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.