Interview Answer

Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to to, let us concentrate rather on explaining to human beings what we want a computer to do. Donald Knuth

How to create view

April 12, 2016 7:26 pm

Comments



How to create view


create view based on hr.employees and hr.departments tables.


												create view employee_details as select e.employee_id, 
												e.first_name,e.salary,e.department_id,d.department_name
														from hr.employees e, hr.departments d where e.department_id=d.department_id;

												
												-- View EMPLOYEE_DETAILS created.

												desc EMPLOYEE_DETAILS
												Name            Null     Type         
												--------------- -------- ------------ 
												EMPLOYEE_ID     NOT NULL NUMBER(6)    
												FIRST_NAME               VARCHAR2(20) 
												SALARY                   NUMBER(8,2)  
												DEPARTMENT_ID            NUMBER(4)    
												DEPARTMENT_NAME NOT NULL VARCHAR2(30) 
												

Solution

   					 
												-- select the data from EMPLOYEE_DETAILS view
												select * from employee_details
																    

Comments



Please login to add comments.