Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

Lab Assignment: Working with Additional Database Objects

LAB OVERVIEW

Scenario and Summary

There is a lot more to a database than just tables and the data in them. A very important part of database security has to do with using and understanding Database Views. Being able to enhance the efficiency of the database tables by using additional indexes is also a very important aspect of database development. Finally, being able to create and use Database Sequences to automate some of the sequential processes in the database can not only save time but improve efficiency. In Lab 7, you will have a chance to work with all three of these areas.

General Lab Information and Considerations

This lab will utilize the same set of tables found in the script file (LeeBooks.SQL) that were used.

Each query in the script file you will create, must be numbered (use either -1 or REM 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 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 scrip file that has queries with errors.
Do number each query using either --1 or REM 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 resulting output file should show both the query statement and result set for each query.

Deliverables

The deliverable for this lab will include:

Your script file with the seven queries and oneexplanation 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. Be sure that you include your answer to question #3 as a comment in this file.

Both documents are to be zipped into a single file before submitting to the iLab Dropbox for Week 7.

LAB STEPS

STEP 1:

Create a simple view named CUST_VIEW using the book_customer table that will display the customer number, first and last name, and the state for every customer currently in the database. Now insert the following data into the book_customer TABLE using an INSERT statement. (Do not use the View for this insert.) CUSTOMERID - 1021, FIRSTNAME - EDWARD, LASTNAME - BLAKE, STATE - TX. Now query your view and display the new record.

STEP 2:

Create a complex view named CUST_ORDER that will list the customer number, last name, and state from the BOOK_CUSTOMER table, in addition to the order number and order date from the BOOK_ORDER table. Insert the following data into this view (use the view for the insert statement): CUSTOMERID - 1022, LASTNAME - smith, STATE - KS, ORDERID - 1021, and ORDERDATE - 10-OCT-2004.

STEP 3:

In your own words, explain why the insert statement for the view you created in Step 2 did not work.

STEP 4:

Create a sequence that can be used to assign a publisher ID number to a new publisher. Define the sequence to start with seven, increment by two, and stop at 1000. Name the sequence PUBNUM_SEQ.

STEP 5:

Insert two new publishers into the PUBLISHER table, one named Double Week with a contact name of Jennifer Close at 800-959-6321, and the second one named Specific House with a contact name of Freddie Farmore at 866-825-3200. Use your new sequence to create the PUBID for each record. Now, query your PUBLISHER table to see your two new records.

STEP 6:

Using a single query, query the PUBNUM_SEQ to determine what both the current sequence number is and the next sequence number will be.

STEP 7:

Create a unique index on the combined columns ORDERID and CUSTOMERID in the BOOK_ORDER table. Give the index a name of BOOK_ORDER_IDX.

STEP 8:

Determine how many objects you currently own in your schema by querying the USER_OBJECTS view in the Data Dictionary. Your result set should list the different object types that you find and include a count by object type.

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M92075502
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in DBMS

Question a suppose you are a marathon runner that can run a

Question : a) Suppose you are a marathon runner that can run a maximum of n miles on a single bottle of water. You are given a map of your marathon route with all the water stations marked. Design an efficient algorithm ...

Question suppose we have two kinds of doctors hospital

Question : Suppose we have two kinds of doctors: hospital doctors and family physicians. In addition to the doctor's id number, name, specialty, and years of experience, we want to record the hospital name for the hospit ...

Database design and development assignment -assessment task

Database Design and Development Assignment - Assessment task - 1. Normalization a) Map the ERD, from the sample solution, into a set of relations in at least Third Normal Form (3NF). You must ensure that your relations m ...

Question sql injection is in the top 10 owasp and common

Question : SQL Injection is in the top 10 OWASP and Common Weakness Enumeration. Using MySQL and PHP, show your own very short and simple application that is vulnerable to this attack. Provide another version that mitiga ...

Question 1 a- consider that you are asked to design an

Question: 1. (a)- Consider that you are asked to design an entity relationship diagram based on the below scenario: A university consists of a number of departments (id, d_name) and each department offers some courses. A ...

Answer the following question explain the difference

Answer the following Question : Explain the difference between a database management system (DBMS) and a database. Are Microsoft Access, SQL Server, and Oracle examples of databases or database management systems (DBMS)?

This assignment is a continuation of this solution the case

This assignment is a continuation of this solution The case study company has received the first report from its enterprise content management (ECM) consultant and now has a documented list of major content requirements ...

Suppose that we have a table of house prices and a table of

Suppose that we have a table of house prices and a table of zip codes: • hprices(hid (PK),address,bedrooms,price,zipcode) • zipcodes(zipcode (PK),state) Write a SQL query that finds the average, maximum, and minimum pric ...

The system development team at the xyz company is working

The system development team at the XYZ Company is working on developing a new customer order entry system. In the process of designing the new system, the team has identified the following data entity attributes: Invento ...

Sqlwrite a select statement that returns three columns from

SQL Write a SELECT statement that returns three columns from the Vendors table: VendorContactFName, VendorContactLName, and VendorName. Sort the result set by last name, then by first name.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As