Question

1. What are three uses for a view? 2. Create a table named COPY_customers from the...

1. What are three uses for a view?

2. Create a table named COPY_customers from the customers table.

3. Use the CREATE or REPLACE option to create a view of all the columns in the COPY_customers table called view_ customers.

4. Use view_ customers to INSERT a row of data into the underlying COPY_customers table. Execute a SELECT * from COPY_customers to verify your DML command.

5. Show the contents of the view_ customers view.

6. Write the statement to create a view including customer_id, customer_last_name, customer_city, and customer_state for all customers who live in OH, NY, and DC.

7. Using your view, write the statement to show the number of customers who live in NY.

8. Write the query to show the name of all your views in your schema. Use the USER_VIEWS. Note that I only need the name of the views

Homework Answers

Answer #1

Table Create

drop table customers;
drop table COPY_customers;


Create table customers(customer_id int Primary key,customer_last_name varchar(40),customer_city varchar(30),customer_state varchar(30));
desc customers;
insert into customers values(101,'Rajgor','OH','Gujrat');
insert into customers values(102,'Viral','NY','Gujrat');
insert into customers values(103,'Navinbhai','DC','Gujrat');
Select * from customers;


/*1 Uses of View */

/* It Provide encapsulation */
/* It Virtual table, not stored permanently */
/* It is used to implement the security mechanism */

/*2 Uses of Old table make new table */
Create table COPY_customers as Select * from customers;
desc COPY_customers;

/*3 Make View */
Create or REPLACE VIEW view_customers as Select * from customers;
Select * from view_customers;


/*4 Insert Row in View */
insert into view_customers values(104,'Paresh','NY','Maharastra');
Select * from view_customers;

/*5 Content of View */
desc view_customers;


/*6 Content of View */
Create View View_Customer_v as Select customer_id,customer_last_name,customer_city,customer_state from customers where customer_city in('OH','NY','DC');
desc View_Customer_v;

/*7 Content of View */
Create View View_Customer_v1 as Select count(*)"Total " from customers where customer_city in('NY');
desc View_Customer_v1;


/*8 All View */

SELECT * FROM DBA_OBJECTS WHERE OBJECT_TYPE = 'VIEW'

if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create...
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create a comment and include your first and last name along with your student ID. Note: The remainder of this task shall be completed within the same script file, “restore.ps1.” B. Write a single script within the “restore.ps1” file that performs all of the following functions without user interaction: 1. Create an Active Directory organizational unit (OU) named “finance.” 2. Import the financePersonnel.csv file (found...
Use the following tables to answer Q5 and Q6. Tourist (tno, Name, phone, age,loc) Vehicle (Vno,...
Use the following tables to answer Q5 and Q6. Tourist (tno, Name, phone, age,loc) Vehicle (Vno, model, mileage, owner_name, owner_ph)) Rented (tno, Vno) 5. (i)Write an SQL query, to create the table vehicle with following constraints: Vno should begin with second letter ‘v’; Models are one among Thar, X3. Mileage should be above 18 and below 25. No two records can have same phone (ii) Write an SQL query to retrieve the name of the owner who does owns X3...
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2. Create a file with name “yourLastName.txt” inside the directory created in step.1 3. Write inside the created file exactly the following content (you may use editors such as vim, pico, ….): Linux Lab Lab. ToDo#1 Summer Semester 2019/2020# 4. Display the first 2 lines of the file. 5. Change the permission of the file to read write and execute for owner, groups and others....
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL CPTR HIST MATH RELB Data Type Text Text Text Text Text Number Currency Date/Time Text DEPT_TITLE Biology Computer Science History Mathematics Religion    Field Name DEPT_CODE DEPT_TITLE Data Type Text Text INSTRUCTIONS Use SQL commands to create the tables and enter the data shown above using MS Access. Write the following SQL statement given below: 1. 2. 3. 4. 5. 6. 7. 8. 9....
please use linux/unix command terminal to complete, step 1 1-create a new directory named by inlab4...
please use linux/unix command terminal to complete, step 1 1-create a new directory named by inlab4 enter directory inlab4 create a new file named by reverse.c with the following contents and then close the file: /*reverse.c */ #include <stdio.h> reverse(char *before, char *after); main() { char str[100]; /*Buffer to hold reversed string */ reverse("cat", str); /*Reverse the string "cat" */ printf("reverse(\"cat\")=%s\n", str); /*Display result */ reverse("noon", str); /*Reverse the string "noon" */ printf("reverse(\"noon\")=%s\n", str); /*Display result */ } reverse(char *before,...
A Guide to SQL Questions 1. How do you create a table using SQL? 2. How...
A Guide to SQL Questions 1. How do you create a table using SQL? 2. How do you delete a table using SQL? 3. What are the common data types used to define columns using SQL? 4. Identify the best data type to use to store the following data in Oracle, in SQL Server, and in Access:    a. The month, day, and year that an employee was hired    b. An employee’s Social Security number    c. The department...
Task 7.1.2. Create a view named nc_jobs which shows all the bookjob information for a job...
Task 7.1.2. Create a view named nc_jobs which shows all the bookjob information for a job with a jobtype of N for publisher with a creditcode of C. CREATE TABLE publishers ( cust_id       CHAR(3) NOT NULL, name        CHAR(10), city        CHAR(10), phone        CHAR(8), creditcode    CHAR(1), primary key (cust_id) ); CREATE TABLE bookjobs ( job_id       CHAR(3) NOT NULL, cust_id       CHAR(3), job_date    DATE, descr CHAR(10), jobtype CHAR(1), primary key (job_id), foreign key...
Time: 10 minutes Objective: Create, view and extract tar archives. Description:  In this activity, the student will...
Time: 10 minutes Objective: Create, view and extract tar archives. Description:  In this activity, the student will use the tar utility to create, view, and extract a tar archive and use it options to name the tar file and view files as they are being archived and extracted. 1.     Start your Linux server virtual machine and sign-on with your individual user ID.  All Activities should begin in your home directory. 2.    Create a directory by typing  mkdir Act6-1 and press Enter.  Switch to this new directory...
-- Table construction (just 1 simplest possible way) CREATE TABLE PetType ( petTypeId VARCHAR(10) PRIMARY KEY,...
-- Table construction (just 1 simplest possible way) CREATE TABLE PetType ( petTypeId VARCHAR(10) PRIMARY KEY, animalType VARCHAR(20), breed VARCHAR(20) ); CREATE TABLE Owner ( ownerId VARCHAR(10) PRIMARY KEY, firstName VARCHAR(20), lastName VARCHAR(20) NOT NULL, homePhoneNumber VARCHAR(20), streetAddress VARCHAR(80), suburb VARCHAR(20), postcode VARCHAR(10) ); CREATE TABLE Pet ( petId VARCHAR(10) PRIMARY KEY, petName VARCHAR(20), sex CHAR(1) CHECK (sex IN ('M', 'F')), petTypeId VARCHAR(10) FOREIGN KEY REFERENCES PetType ); CREATE TABLE PetAndOwner ( ownerId VARCHAR(10), petId VARCHAR(10), PRIMARY KEY (ownerId, petId),...
Saul wants to buy a new writer's desk, but he doesn't want to spend more than...
Saul wants to buy a new writer's desk, but he doesn't want to spend more than $350. Write a select statement to find products matching these requirements For each customer, list the customer name and city and state in this format: City, State (one column) Display only those orders where more than one different product has been ordered Find the average price of bookcases A. List all the customers and list the number of different shipping addresses for each. Customers...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT