WhatsApp +1 (332) 244-5747

Building the Physical Model

Get your custom paper done at low prices


275 words/page


Double spacing


Free formatting (APA, MLA, Chicago, Harvard and others)


12 point Arial/Times New Roman font


Free title page


Free bibliography & reference

CIS 336, Lab 4 of 7: Building the Physical Model Scenario/SummaryLab #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’sDo 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, each with a comment identifying the step number. 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 iLab Dropbox for Week 4. STEP 1: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 2: Using the BOOK_ORDER table, write a query that will list the OrderID, CustomerID, OrderDate, and ShipState for orders placed prior to April 1, 2009.STEP 3: Using the BOOK_ORDER table, write a query that will list everything about the orders that have not been shipped yet.STEP 4: Using the BOOKS table, write a query that will list the categories for the books in the Books table. Use the appropriate key word to list each category only once in your result set.STEP 5: 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 6: 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 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 California or Washingto 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 $27.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 May 5, 2009 including those placed on April 2nd and May 5th. 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 31, 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


What Students Are Saying

Outstanding service, thank you very much.

Undergraduate Student

English, Literature

Awesome. Will definitely use the service again.

Master's Student

Computer Science