Interview Answer

Any fool can write code that a computer can understand. Good programmers write code that humans can understand. Martin Fowler

How to create view

January 1, 1970 12:00 am

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.