In: Computer Science
(SQL Coding)
Name the view: view_job_history. Select all columns to be included in the view.
Add a WHERE clause to restrict the employee_id to be greater than 150. Add the WITH READ ONLY option.
Show me the code used to create the view and the results of a select statement on the view.
Code for Creating View view_job_history and display the results are as follows.
create view view_job_history as select * from job_history where employee_id > 150 with read only;
select * from view_job_history;
Table job_history contains the following data.
EMPLOYEE_ID ENAME JOB MGR
HIREDATE SAL
----------- ---------- --------- ---------- ---------
----------
7369 SMITH CLERK 7902 17-DEC-80 800
7499 ALLEN SALESMAN 7698 20-FEB-81 1600
7521 WARD SALESMAN 7698 22-FEB-81 1250
7566 JONES MANAGER 7839 02-APR-81
2975
7654 MARTIN SALESMAN 7698 28-SEP-81 1250
7698 BLAKE MANAGER 7839 01-MAY-81
2850
7782 CLARK MANAGER 7839 09-JUN-81
2450
7788 SCOTT ANALYST 7566 09-DEC-82
3000
7839 KING PRESIDENT 17-NOV-81 5000
7844 TURNER SALESMAN 7698 08-SEP-81 1500
7876 ADAMS CLERK 7788 12-JAN-83 1100
7900 JAMES CLERK 7698 03-DEC-81 950
7902 FORD ANALYST 7566 03-DEC-81 3000
7934 MILLER CLERK 7782 23-JAN-82 1300
100 Prakash Progr 7712
10-JUL-99 10000
101 Chiranjibi Progr 7717
10-JUL-98 15000
Screen Shots