Question

In: Computer Science

lab requires you to use Oracle VIEW to implement a virtual database on DBSEC schema, for...

lab requires you to use Oracle VIEW to implement a virtual database on DBSEC schema, for example, on CUSTOMER table. Your task is to develop a single SQL script that will perform all the following tasks:

Table created for this assignment is listed below:

create table CUSTOMER_VPD(

SALES_REP_ID NUMBER(4),

CUSTOMER_ID NUMBER(8) NOT NULL,

CUSTOMER_SSN VARCHAR(9),

FIRST_NAME VARCHAR(20),

LAST_NAME VARCHAR(20),

ADDR_LINE VARCHAR(40),

CITY VARCHAR(30),

STATE VARCHAR(30),

ZIP_CODE VARCHAR(9),

PHONE VARCHAR(15),

EMAIL VARCHAR(80),

CC_NUMBER VARCHAR(20),

CREDIT_LIMIT NUMBER,

GENDER CHAR(1),

STATUS CHAR(1),

COMMENTS VARCHAR(1025),

USER_NAME VARCHAR(30)

);

Tasks:

Populate the CUSTOMER_VPD table with four rows of records. Pay attention to the column CTL_UPD_USER,

Create a VIEW named as MY_VIEW to display only rows that belong to the logged in user

Grant SELECT and INSERT privilege on MY_VIEW to DBSEC_CLERK

Insert one row of data into MY_VIEW as DBSEC_CLERK by using the following data

Verify your data insertion by query MY_VIEW. You (as DBSEC_CLERK) should only see one row of data you have inserted. This signifies the success of your implementation.

Solutions

Expert Solution

Below you can find everything clear and feel free to ask any doubts and please don't forget to give upvote as it means a lot. Thanks:)

/*firstly login with DBSEC*/

connect DBSEC/password

/* Task A)------->Create table customer*/
create table CUSTOMER(
SALES_REP_ID NUMBER(4),
CUSTOMER_ID NUMBER(8) NOT NULL,
CUSTOMER_SSN VARCHAR(9),
FIRST_NAME VARCHAR(20),
LAST_NAME VARCHAR(20),
ADDR_LINE VARCHAR(40),
CITY VARCHAR(30),
STATE VARCHAR(30),
ZIP_CODE VARCHAR(9),
PHONE VARCHAR(15),
EMAIL VARCHAR(80),
CC_NUMBER VARCHAR(20),
CREADIT_LIMIT NUMBER,
GENDER CHAR(1),
STATUS CHAR(1),
COMMENTS VARCHAR(1025),
USER_NAME VARCHAR(30)
);


/* Task B)------>Creating view object And username is given username*/

Create view MY_VIEW as select SALES_REP_ID,CUSTOMER_ID,CUSTOMER_SSN,FIRST_NAME,LAST_NAME,
ADDR_LINE,CITY,STATE,ZIP_CODE,PHONE,EMAIL,CC_NUMBER,CREADIT_LIMIT,GENDER,STATUS,COMMENTS,USER_NAME
from customer where USER_NAME=username;

/* Task C)--------> grant */
grant select,insert on MY_VIEW to DBSEC;


/* Task D)---------->insert a row using view*/
INSERT INTO DBSEC.MY_VIEW ( SALES_REP_ID, CUSTOMER_ID, CUSTOMER_SSN, FIRST_NAME, LAST_NAME, ADDR_LINE,
CITY, STATE, ZIP_CODE, PHONE, EMAIL, CC_NUMBER, CREDIT_LIMIT, GENDER, STATUS,
COMMENTS, USER_NAME) VALUES (
7415, 901340, '969996976', 'Joe', 'Cat', '993888 Moreno St.', 'Champaign', 'IL'
, ' 61801', '2173331613', '[email protected]', '2311468327372669', 20000
, 'M', 'A', 'A fun loving student', user);


Related Solutions

This refer to the “om” database (or Schema) that you will find in your MySQL Workbench...
This refer to the “om” database (or Schema) that you will find in your MySQL Workbench program if you have run the sample database install script. Please save all of your answers in one script (.sql) or type all your answers into Notepad++ and submit them as a single .sql file. Please test your SQL statements in Workbench 1.       Using an INNER JOIN, select the order_id, order_date, shipped_date, fname, and customer_phone from the orders and customers tables. The fname is a...
All questions in this assignment refer to the “om” database (or Schema) that you will find...
All questions in this assignment refer to the “om” database (or Schema) that you will find in your MySQL Workbench program if you have run the sample database install script. Please save all of your answers in one script (.sql) or type all your answers into Notepad++ and submit them as a single .sql file. You are encouraged to test your SQL statements in Workbench, and please use the ‘tidy’ tool to properly format your SQL before you save it...
using mysql and the schema is provided below. thanks In this lab, you will be manipulating...
using mysql and the schema is provided below. thanks In this lab, you will be manipulating the database to add, delete and modify the values in the database. Please use a "select * from..." after each query to show the effects of your data manipulation query. 1. The title 'Time Flies' now has a new track, the 11th track 'Spring', which is 150 seconds long and has only a MP3 file. Insert the new track into Tracks table (Don’t hand-code...
Determination of gplanet from the Period data of the Pendulum Virtual Lab Learning Objective: Use the...
Determination of gplanet from the Period data of the Pendulum Virtual Lab Learning Objective: Use the dimensions and period of a pendulum to determine the gravitational acceleration of the planet on which the pendulum is set in motion. Go to the University of Colorado – Boulder PhET website/Pendulum Lab. Conduct four experiments with a 1 kg mass and a 10° pull-back angle from the vertical as controlled variables. The pendulum lengths should be between 0.250 m to 2.500 m, inclusive....
You have been requested to design a schema (as an E/R diagram) for the contact-tracing database....
You have been requested to design a schema (as an E/R diagram) for the contact-tracing database. Your group is busy working to design and field a contact-tracing database to be able to trace rapidly people who may have been in close proximity (contact) to someone diagnosed with a highly infectious disease. The Contact Tracing Domain To be able to trace with whom a person has been in contact, we need to know where that person has been and when. We...
Can you please implement this in Oracle sql Write a SELECT statement that returns one row...
Can you please implement this in Oracle sql Write a SELECT statement that returns one row for each customer that has orders with these columns: The email_address from the Customers table A count of the number of orders The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.) Return only those rows where the customer has more than 1 order. Sort the result set in descending sequence by the sum...
Use the Securities and Exchange Commission’s EDGAR corporate filings database to search for and view the...
Use the Securities and Exchange Commission’s EDGAR corporate filings database to search for and view the annual reports on Form 10-K of Google and Yahoo. Google: https://www.sec.gov/Archives/edgar/data/1288776/000128877615000008/0001288776-15-000008-index.htm Yahoo: https://www.sec.gov/Archives/edgar/data/1011006/000119312515066560/0001193125-15-066560-index.htm Click on the Document Link for 10-K, In the Table of Contents, go to Item 8 Financial Statements and Supplementary Data. Using information from the statement of cash flows, answer the following questions for each company: 1. Which method, direct or indirect, was used to prepare the company’s Statement of Cash...
What will happen if you forget to implement the pure virtual function in the derived class?...
What will happen if you forget to implement the pure virtual function in the derived class? How the following are achieved in C++? static polymorphism and dynamic polymorphism. What is the advantage of defining the member functions outside a class rather than defining inside a class?
Data Manipulation In this lab, you will be manipulating the database to add, delete and modify...
Data Manipulation In this lab, you will be manipulating the database to add, delete and modify the values in the database. Please use a "select * from..." after each query to show the effects of your data manipulation query. 1. The title 'Time Flies' now has a new track, the 11th track 'Spring', which is 150 seconds long and has only a MP3 file. Insert the new track into Tracks table (Don’t hand-code any data for insert that can be...
a java code In this lab you will implement an inorder traversal, and a search for...
a java code In this lab you will implement an inorder traversal, and a search for a 2-3-4 tree. The inorder traversal will print the contents (integers) of the tree, and the search method will return a boolean, indicating whether a given key was found in the tree. Examine the provided template. The main method is provided for you, as well as a template of the Node and 2-3-4 classes. The main method will read either "inorder" or an integer...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT