Create simple view named cust-view using book-customer table

Assignment Help Database Management System
Reference no: EM131320901

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.

Reference no: EM131320901

Questions Cloud

What is the ocf for this project : H. Cochran, Inc., is considering a new three-year expansion project that requires an initial fixed asset investment of $2,310,000. The fixed asset will be depreciated straight-line to zero over its three-year tax life, after which time it will be wor..
Create a java application to generate x random integer value : Create your own simple Java application to generate X random Integer values between 0 and Y. Use command line arguments for entry of X and Y. Demonstrate your code compiles and runs without issue using screen captures as appropriate.
What quality of decorum did drew violate in this example : When Drew gave the toast at his best friend's wedding reception, he failed to notice the shocked looks as he told some off-color stories about the happy couple's dating life. What quality of decorum did Drew violate in this example
Obtain quadratic equation and explicit analytical solution : Obtain the quadratic equation and the explicit analytical solution for N which is valid at all temperatures below the intrinsic temperature.
Create simple view named cust-view using book-customer table : 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.
What can researchers do to minimize error variance : Discuss the trade-off between internal and external validity. Which is more important? Explain.
Onsidering sale of new sound board used in recording studios : Rolston Music Company is considering the sale of a new sound board used in recording studios. The new board would sell for $26,300, and the company expects to sell 1,480 per year. The company currently sells 1,980 units of its existing model per year..
Important aspect of retailing : Merchandising is an especially important aspect of retailing. Buyers must curate product lines and programs that appeal to their target market(s) while ensuring that activities (purchased inventory, pricing, etc.)
How do researchers detect and eliminate placebo effects : Should demand characteristics be eliminated or strengthened in an experiment? Explain.

Reviews

Write a Review

Database Management System Questions & Answers

  What does the sd for the two sections tell us

For the variable "Points on Final," what does the SD for the two sections tell us about the performance of the two groups on the final exam?

  Display structure of the i_model table

Display structure of the i_model table. Display all the information stored in the i_model table belonging to car group ‘A4'.

  Delete a particular student name and mark

delete a particular student name and mark

  Identify the primary decisions a database administrator make

With the obvious pace of current technology development, data continues to grow daily. Imagine that you are a Database Administrator for a large organization. Identify the primary decisions a Database Administrator must make in order to manage such d..

  Sketch diagram for data warehouse of shop by star schema

Assume that data warehouse for video game shop consists of th three dimensions: time, player, and game, and two measures number of games played and price paid per game. Sketch schema diagram for data warehouse using the star schema.

  Highest average mark

Write a program to calculate and store the average obtained by 20 pupils in 7 subjects. Output the pupil that made the highest average mark in addition to those pupils making 50 marks and over.

  Design and implement a small database application

Perform the conceptual database design using Entity-Relationship model. You must submit the Entity-Relationship diagram of your database and develop queries in the target DBMS

  Explain class diagram

Explain Class diagram. Outline the main steps in developing a class diagram for a Use Case(UC).

  Executing well-planned strategy-manage technology solution

You have a company, specializing in managing technology solutions. you have ben just hired by big firm to execute a well-planned strategy.

  Discuss about the database security

Discuss about the database security.We will focus three topics for this conference:Inference in ordinary databases or statistical databases,database privacy (through encryption),andcloud security.

  Analysis of the sales numbers to management

Create a graph or chart that compares the data in a meaningful way, i.e. compare regions by month, compare products by month, etc. Create a spreadsheet formatted to present your analysis of the sales numbers to management.

  Normalization and writing sql statements

Experience in with database modelling, normalization and writing SQL statements - Create an Entity Relationship Diagram (ERD) to help you decide on the relationships.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd