Interview Answer

Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. Alan Kay

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.